Reputation: 1568
I have a geodataframe:
gdf
name ... geometry
0 INET_PL_273_EE_0_Seg_0_Seg_0 ... {'type': 'LineString', 'coordinates': [[23.896...
1 INET_PL_273_EE_1_Seg_0_Seg_0 ... {'type': 'LineString', 'coordinates': [[22.241...
2 INET_PL_357_Seg_0_Seg_0 ... {'type': 'LineString', 'coordinates': [[13.592...
3 INET_PL_359_Seg_0_Seg_0 ... {'type': 'LineString', 'coordinates': [[13.592...
4 INET_PL_361_Seg_0_Seg_0 ... {'type': 'LineString', 'coordinates': [[13.592...
... ... ... ...
6318 EntsoG_Map__ST_25_Seg_0 ... {'type': 'LineString', 'coordinates': [[13.887...
6319 EntsoG_Map__ST_26_Seg_0 ... {'type': 'LineString', 'coordinates': [[23.080...
6320 EntsoG_Map__ST_26_Seg_0 ... {'type': 'LineString', 'coordinates': [[6.7552...
6321 EntsoG_Map__ST_448_Seg_0 ... {'type': 'LineString', 'coordinates': [[25.348...
6322 EntsoG_Map__ST_449_Seg_0 ... {'type': 'LineString', 'coordinates': [[25.348...
[6323 rows x 7 columns]
I created the geometry column via gdf['geometry'] = gdf['geometry'].apply(lambda x: shapely.geometry.mapping(x))
. Now I want to convert it back.
Any simple hack?
Upvotes: 0
Views: 1112
Reputation: 1568
shape()
function converts it back:
gdf['geometry'] = gdf['geometry'].apply(lambda x: shapely.geometry.shape(x))
Upvotes: 1