I have a DataFrame where one column consists of lines stored like so:
'[[-7.61, 42.15],[-6.62, 43.16],[-8.9, 41.0],[-9.2, 40.5]]'
Is there an easy way to read these lines directly into shapely LineStrings so I can treat this as a GeoDataFrame?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
Actually, I just sorted it out, though I am happy for suggested improvements:
line = '[[-7.61, 42.15],[-6.62, 43.16],[-8.9, 41.0],[-9.2, 40.5]]' import ast line = LineString(ast.literal_eval(line))