I have a WKT file containing some geometric data.
Here's the sample (polyline):
s = "ST_GeomFromText( 'LINESTRING( 11.6614 48.0189, 11.6671 48.011, 11.6712 48.0051, 11.6747 48.0001, 11.6777 47.9956, 11.6795 47.9927)',4326)"
What I want is the coordinates of the points. So I did the following:
s2 = s.split("'")[1] s3 = s2.split("(")[1] s4 = s3.strip(' )') s5 = s4.split(',') print s5 ['11.6614 48.0189', ' 11.6671 48.011', ' 11.6712 48.0051', ' 11.6747 48.0001', ' 11.6777 47.9956', ' 11.6795 47.9927']
the s2, s3, s4 and s5 are just dummy variables to demonstrate that this solution cannot be good and evil.
Is there a more concise solution for this?
source share