gemgis.vector.extract_xyz_points#

gemgis.vector.extract_xyz_points(gdf: geopandas.geodataframe.GeoDataFrame) geopandas.geodataframe.GeoDataFrame#

Extracting X, Y, and Z coordinates from a GeoDataFrame containing Shapely Points with Z components

Parameters

gdf (gpd.geodataframe.GeoDataFrame) – GeoDataFrame containing Shapely Points with X, Y, and Z components

Returns

gdf – GeoDataFrame containing Shapely Points with appended X, Y, and Z columns

Return type

gpd.geodataframe.GeoDataFrame

New in version 1.0.x.

Example

>>> # Loading Libraries and creating Shapely Point
>>> import gemgis as gg
>>> from shapely.geometry import Point
>>> import geopandas as gpd
>>> point = Point(1,2,4)
>>> point.wkt
'POINT Z (0 0 0)'
>>> # Creating GeoDataFrame from Point
>>> gdf = gpd.GeoDataFrame(geometry=[point, point])
>>> gdf
    geometry
0   POINT Z (0.00000 0.00000 0.00000)
1   POINT Z (0.00000 0.00000 0.00000)
>>> # Extracting X, Y, and Z Coordinates from Point Objects
>>> gdf = gg.vector.extract_xyz_points(gdf=gdf)
>>> gdf
    geometry                            X       Y       Z
0   POINT Z (1.00000 2.00000 3.00000)   1.00    2.00    3.00
1   POINT Z (1.00000 2.00000 3.00000)   1.00    2.00    3.00

See also

extract_xyz_linestrings

Extracting X and Y coordinates from a GeoDataFrame containing Shapely LineStrings with Z components

extract_xyz_polygons

Extracting X and Y coordinates from a GeoDataFrame containing Shapely Polygons with Z component