geopandas.GeoSeries.from_xy#

classmethod GeoSeries.from_xy(x, y, z=None, index=None, crs=None, **kwargs)#

替代构造函数以创建 GeoSeries X,y(,z)坐标列表或数组中的点几何图形

在地理坐标的情况下,假设经度由 x 坐标和纬度按 y

参数
x、y、z可迭代的
index类似数组或索引,可选

GeoSeries的索引。如果没有给定,并且所有坐标输入都是具有相等索引的级数,则使用该索引。

crs值,可选

几何对象的坐标系。可以是任何可以接受的 pyproj.CRS.from_user_input() 例如,授权字符串(例如“EPSG:4326”)或WKT字符串。

**kwargs

传递给Series构造函数的其他参数,例如 name

退货
GeoSeries

示例

>>> x = [2.5, 5, -3.0]
>>> y = [0.5, 1, 1.5]
>>> s = geopandas.GeoSeries.from_xy(x, y, crs="EPSG:4326")
>>> s
0    POINT (2.50000 0.50000)
1    POINT (5.00000 1.00000)
2    POINT (-3.00000 1.50000)
dtype: geometry