gemgis.visualization.create_lines_3d_linestrings#

gemgis.visualization.create_lines_3d_linestrings(gdf: geopandas.geodataframe.GeoDataFrame, dem: Union[rasterio.io.DatasetReader, numpy.ndarray], extent: List[Union[int, float]] = None) geopandas.geodataframe.GeoDataFrame#

Creating lines with z-component (LineString Z)

Parameters
  • gdf (gpd.geodataframe.GeoDataFrame) – GeoDataFrame containing the LineStrings to be converted to linestrings with z-component

  • dem (Union[rasterio.io.DatasetReader, np.ndarray]) – Rasterio object or NumPy array containing the height values

  • extent (List[Union[int, float]]) – List containing the bounds of the raster, e.g. extent=[0, 972, 0, 1069]

Returns

gdf_3d – GeoDataFrame containing the LineStrings with Z component (LineString Z)

Return type

gpd.geodataframe.GeoDataFrame

New in version 1.0.x.

Example

>>> # Loading Libraries and File
>>> import gemgis as gg
>>> import geopandas as gpd
>>> import rasterio
>>> gdf = gpd.read_file(filename='file.shp')
>>> gdf
id      formation   geometry
0   None    Unterjura   LINESTRING (32522415.430 5777985.396, 32521520...
1   None    Unterjura   LINESTRING (32479802.616 5782183.163, 32480593...
2   None    Mitteljura  LINESTRING (32522376.263 5779907.729, 32520580...
3   None    Mitteljura  LINESTRING (32463272.196 5788327.350, 32464107...
>>> # Loading Digital Elevation Model
>>> dem = rasterio.open('raster.tif')
>>> # Create LineStrings with Z-component
>>> gdf_3d = gg.visualization.create_lines_3d_linestrings(gdf=gdf, dem=dem)
>>> gdf_3d
    id      formation   geometry
0   None    Unterjura   LINESTRING Z (32522415.430 5777985.396 213.000...
1   None    Unterjura   LINESTRING Z (32479802.616 5782183.163 84.000,...
2   None    Mitteljura  LINESTRING Z (32522376.263 5779907.729 116.000...
3   None    Mitteljura  LINESTRING Z (32463272.196 5788327.350 102.000...

See also

create_lines_3d_polydata

Creating lines with z-component for the plotting with PyVista

create_dem_3d

Creating a mesh from a Digital Elevation Model

create_points_3d

Creating a mesh from points