dtoolkit.geoaccessor.geodataframe.coordinates#
- dtoolkit.geoaccessor.geodataframe.coordinates(df: GeoDataFrame, /, **kwargs) Series[source]#
Gets coordinates from each geometry of
GeoDataFrame.A sugary syntax wraps
shapely.get_coordinates().- Parameters
- **kwargs
See the documentation for
shapely.get_coordinates()for complete details on the keyword arguments.
- Returns
- Series
See also
shapely.get_coordinatesThe core algorithm of this accessor.
dtoolkit.geoaccessor.geoseries.coordinatesGets coordinates from each geometry of GeoSeries.
dtoolkit.geoaccessor.geodataframe.coordinatesGets coordinates from each geometry of GeoDataFrame.
Examples
>>> import dtoolkit.geoaccessor >>> import geopandas as gpd >>> df = gpd.GeoSeries.from_wkt( ... [ ... "POINT (0 0)", ... "LINESTRING (2 2, 4 4)", ... None, ... ], ... ).to_frame("geometry") >>> df geometry 0 POINT (0.00000 0.00000) 1 LINESTRING (2.00000 2.00000, 4.00000 4.00000) 2 None >>> df.coordinates() 0 [[0.0, 0.0]] 1 [[2.0, 2.0], [4.0, 4.0]] 2 [] Name: geometry, dtype: object