geopandas.GeoSeries.from_xy#
- classmethod GeoSeries.from_xy(x, y, z=None, index=None, crs=None, **kwargs)[来源]#
备用构造函数,用于从 x、y(、z) 坐标的列表或数组创建一个
GeoSeries的点几何图形在地理坐标的情况下,假设经度由
x坐标捕获,纬度由y捕获。- Parameters:
- x, y, ziterable
- indexarray-like or Index, optional
GeoSeries 的索引。如果未给出且所有坐标输入都是具有相同索引的 Series,则使用该索引。
- crsvalue, optional
几何对象的坐标参考系统。可以是任何被
pyproj.CRS.from_user_input()接受的内容,例如一个权威字符串(例如“EPSG:4326”)或一个WKT字符串。- **kwargs
传递给Series构造函数的附加参数,
例如name。
- Returns:
- 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.5 0.5) 1 POINT (5 1) 2 POINT (-3 1.5) dtype: geometry