gemgis.vector.extract_interfaces_coordinates_from_cross_section
gemgis.vector.extract_interfaces_coordinates_from_cross_section#
- gemgis.vector.extract_interfaces_coordinates_from_cross_section(linestring: shapely.geometry.linestring.LineString, interfaces_gdf: geopandas.geodataframe.GeoDataFrame, extract_coordinates: bool = True) geopandas.geodataframe.GeoDataFrame #
Extracting coordinates of interfaces digitized on a cross section
- Parameters
linestring (shapely.geometry.linestring.LineString) – Shapely LineString containing the trace of a cross section on a map, e.g.
linestring = LineString([(0, 0), (20, 20)])
interfaces_gdf (gpd.geodataframe.GeoDataFrame) – GeoDataFrame containing the LineStrings of interfaces digitized on a cross section
- Returns
gdf – GeoDataFrame containing the extracted coordinates, depth/elevation data and additional columns
- Return type
gpd.geodataframe.GeoDataFrame
New in version 1.0.x.
Example
>>> # Loading Libraries and creating LineString >>> import gemgis as gg >>> from shapely.geometry import Point, LineString >>> import geopandas as gpd >>> linestring = LineString([(0, 0), (20, -20)]) >>> linestring.wkt 'LINESTRING (0 0, 20 -20)'
>>> # Creating second LineString >>> interfaces = LineString([(2, -2), (5, -5)]) >>> interfaces.wkt 'LINESTRING (2 -2, 5 -5)'
>>> # Creating GeoDataFrame from LineString >>> gdf = gpd.GeoDataFrame(geometry=[interfaces, interfaces]) >>> gdf geometry 0 LINESTRING (2.0 -2.0, 5.0 -5.0) 1 LINESTRING (2.0 -2.0, 5.0 -5.0)
>>> # Extracting interfaces coordinates from cross sections >>> gdf_points = gg.vector.extract_interfaces_coordinates_from_cross_section(linestring=linestring, interfaces_gdf=gdf) >>> gdf_points geometry X Y Z 0 POINT (1.41421 -1.41421) 1.41 -1.41 -2.00 1 POINT (3.53553 -3.53553) 3.54 -3.54 -5.00 2 POINT (1.41421 -1.41421) 1.41 -1.41 -2.00 3 POINT (3.53553 -3.53553) 3.54 -3.54 -5.00
See also
calculate_coordinates_for_point_on_cross_section
Calculating the coordinates for a Point on a cross section
calculate_coordinates_for_linestring_on_cross_sections
Calculating the coordinates for one LineString on cross sections
calculate_coordinates_for_linestrings_on_cross_sections
Calculating the coordinates for LineStrings on cross sections
extract_xyz_from_cross_sections
Extracting the X, Y, and Z coordinates of interfaces from cross sections