繁体   English   中英

如何从线串中获取经度/纬度

[英]How to get the longitude/latitude from a linestring

我有一个带有一列线串的数据框。 我想将线串转换为其相应的纬度/经度,以便我可以用底图绘制它。 我的代码如下:

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

几何列看起来像这样:几何列

如何转换长字符串数据?

我认为你可以简单地使用

Lats, Lons = LineStringObject.coords.xy

它将分别返回纬度和经度数组。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM