LineString-获取坐标为DataFrame

问题描述 投票:0回答:1

我有一个带[GeoSeries的geopandas数据框。

此列只有一个条目,shapely.geometry.linestring.LineString

LineString (first_lon first_lat, second_lon second_lat, ...)

我找不到一种简单的方法来获取此LineString的坐标作为DataFrame,如

LON           LAT
first_lon     first_LAT
second_lon    second_LAT
...

是否有内置功能?

Thx

python-3.x pandas geopandas shapely
1个回答
0
投票
x,y = LineStringObject.coords.xy
pd.DataFrame(list(zip(x,y)), columns=['LAT', 'LON'])

似乎可以完成这项工作。

© www.soinside.com 2019 - 2024. All rights reserved.