我有一个带有一列线串的数据框。我想将线串转换为其相应的纬度/经度,以便可以使用底图进行绘制。我的代码如下:
gdf = gpd.read_file('./call2016.shp') #read the data into a variable
streetsaslinestring = gdf.loc[: , "geometry"] #getting the linestring column
接下来,我要按lon / lat所述转换数据。
streetsinlatlong = convert_etrs89_to_lonlat(streetsaslinestring)
streetsinlatlong.to_file('./streetslonglat.shp') #store it as .shp in order to plot it with basemap
m.readshapefile('./streetslonglat', 'streets') #read as shape file
“几何”列如下所示:geometry column
如何转换长字符串数据?
答案 0 :(得分:0)
我认为你可以简单地使用
Lats, Lons = LineStringObject.coords.xy
它将分别返回纬度和经度数组。