@@ -8555,12 +8555,12 @@ def create_bbox(extent: List[Union[int, float]]) -> shapely.geometry.polygon.Pol
8555
8555
Parameters
8556
8556
----------
8557
8557
extent : List[Union[int, float]]
8558
- List of minx, maxx, miny, maxy values, e.g. ``extent=[0, 972, 0, 1069]``
8558
+ List of minx, maxx, miny, maxy values, e.g. ``extent=[0, 972, 0, 1069]``.
8559
8559
8560
8560
Returns
8561
8561
-------
8562
8562
bbox : shapely.geometry.polygon.Polygon
8563
- Rectangular polygon based on extent
8563
+ Rectangular polygon based on extent.
8564
8564
8565
8565
.. versionadded:: 1.0.x
8566
8566
@@ -8606,33 +8606,33 @@ def set_dtype(
8606
8606
Parameters
8607
8607
----------
8608
8608
gdf : gpd.geodataframe.GeoDataFrame
8609
- GeoDataFrame containing the input vector data with uncorrected dtypes
8609
+ GeoDataFrame containing the input vector data with uncorrected dtypes.
8610
8610
8611
8611
dip : str
8612
- Name of the column containing the dip data, e.g ``dip='dip'``
8612
+ Name of the column containing the dip data, e.g ``dip='dip'``.
8613
8613
8614
8614
azimuth : str
8615
- Name of the column containing the azimuth data, e.g ``azimuth='azimuth'``
8615
+ Name of the column containing the azimuth data, e.g ``azimuth='azimuth'``.
8616
8616
8617
8617
formation : str
8618
- Name of the column containing the formation data, e.g ``formation='formation'``
8618
+ Name of the column containing the formation data, e.g ``formation='formation'``.
8619
8619
8620
8620
polarity : str
8621
- Name of the column containing the polarity data, e.g ``polarity='polarity'``
8621
+ Name of the column containing the polarity data, e.g ``polarity='polarity'``.
8622
8622
8623
8623
x : str
8624
- Name of the column containing the x coordinates, e.g ``x='X'``
8624
+ Name of the column containing the x coordinates, e.g ``x='X'``.
8625
8625
8626
8626
y : str
8627
- Name of the column containing the y coordinates, e.g ``y='Y'``
8627
+ Name of the column containing the y coordinates, e.g ``y='Y'``.
8628
8628
8629
8629
z : str
8630
- Name of the column containing the z coordinates, e.g ``z='Z'``
8630
+ Name of the column containing the z coordinates, e.g ``z='Z'``.
8631
8631
8632
8632
Returns
8633
8633
-------
8634
8634
gdf : gpd.geodataframe.GeoDataFrame
8635
- GeoDataFrame containing the input vector data with corrected dtypes
8635
+ GeoDataFrame containing the input vector data with corrected dtypes.
8636
8636
8637
8637
.. versionadded:: 1.0.x
8638
8638
@@ -8724,20 +8724,20 @@ def create_polygons_from_faces(
8724
8724
Parameters
8725
8725
----------
8726
8726
mesh : pv.core.pointset.PolyData
8727
- PyVista PolyData dataset
8727
+ PyVista PolyData dataset.
8728
8728
8729
8729
crs : Union[str, pyproj.crs.crs.CRS]
8730
- Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``
8730
+ Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``.
8731
8731
8732
8732
8733
8733
return_gdf : bool
8734
8734
Variable to either return the data as GeoDataFrame or as list of LineStrings.
8735
- Options include: ``True`` or ``False``, default set to ``True``
8735
+ Options include: ``True`` or ``False``, default set to ``True``.
8736
8736
8737
8737
Returns
8738
8738
-------
8739
8739
polygons : Union[List[shapely.geometry.polygon.Polygon], gpd.geodataframe.GeoDataFrame]
8740
- Triangular Shapely Polygons representing the faces of the mesh
8740
+ Triangular Shapely Polygons representing the faces of the mesh.
8741
8741
8742
8742
.. versionadded:: 1.0.x
8743
8743
@@ -8763,13 +8763,14 @@ def create_polygons_from_faces(
8763
8763
>>> # Create polygons from mesh faces
8764
8764
>>> polygons = gg.vector.create_polygons_from_faces(mesh=mesh)
8765
8765
>>> polygons
8766
- geometry
8767
- 0 POLYGON Z ((297077.414 5677487.262 -838.496, 2...
8768
- 1 POLYGON Z ((298031.070 5678779.547 -648.688, 2...
8769
- 2 POLYGON Z ((297437.539 5676992.094 -816.608, 2...
8770
- 3 POLYGON Z ((298031.070 5678779.547 -648.688, 2...
8771
- 4 POLYGON Z ((295827.680 5680951.574 -825.328, 2...
8772
-
8766
+ | Index | Geometry |
8767
+ +-------+-----------------------------------------------------+
8768
+ | 0 | POLYGON Z ((297077.414 5677487.262 -838.496, 2...)) |
8769
+ | 1 | POLYGON Z ((298031.070 5678779.547 -648.688, 2...)) |
8770
+ | 2 | POLYGON Z ((297437.539 5676992.094 -816.608, 2...)) |
8771
+ | 3 | POLYGON Z ((298031.070 5678779.547 -648.688, 2...)) |
8772
+ | 4 | POLYGON Z ((295827.680 5680951.574 -825.328, 2...)) |
8773
+ +-------+-----------------------------------------------------+
8773
8774
"""
8774
8775
# Checking that the input mesh is a PyVista PolyData dataset
8775
8776
if not isinstance (mesh , pv .core .pointset .PolyData ):
@@ -8811,19 +8812,19 @@ def unify_polygons(
8811
8812
Parameters
8812
8813
----------
8813
8814
polygons : Union[List[shapely.geometry.polygon.Polygon], gpd.geodataframe.GeoDataFrame]
8814
- Triangular Shapely Polygons representing the faces of the mesh
8815
+ Triangular Shapely Polygons representing the faces of the mesh.
8815
8816
8816
8817
crs : Union[str, pyproj.crs.crs.CRS]
8817
- Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``
8818
+ Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``.
8818
8819
8819
8820
return_gdf : bool
8820
8821
Variable to either return the data as GeoDataFrame or as list of LineStrings.
8821
- Options include: ``True`` or ``False``, default set to ``True``
8822
+ Options include: ``True`` or ``False``, default set to ``True``.
8822
8823
8823
8824
Returns
8824
8825
-------
8825
8826
polygons_merged : Union[List[shapely.geometry.polygon.Polygon], gpd.geodataframe.GeoDataFrame]
8826
- Merged Shapely Polygons
8827
+ Merged Shapely Polygons.
8827
8828
8828
8829
.. versionadded:: 1.0.x
8829
8830
@@ -8834,22 +8835,26 @@ def unify_polygons(
8834
8835
>>> import geopandas as gpd
8835
8836
>>> polygons = gpd.read_file(filename='file.shp')
8836
8837
>>> polygons
8837
- geometry
8838
- 0 POLYGON Z ((297077.414 5677487.262 -838.496, 2...
8839
- 1 POLYGON Z ((298031.070 5678779.547 -648.688, 2...
8840
- 2 POLYGON Z ((297437.539 5676992.094 -816.608, 2...
8841
- 3 POLYGON Z ((298031.070 5678779.547 -648.688, 2...
8842
- 4 POLYGON Z ((295827.680 5680951.574 -825.328, 2...
8843
-
8838
+ | Index | Geometry |
8839
+ +-------+--------------------------------------------------------------------------+
8840
+ | 0 | POLYGON Z ((297077.414 5677487.262 -838.496, 298031.070 5678779.547..... |
8841
+ | 1 | POLYGON Z ((298031.070 5678779.547 -648.688, 297437.539 5676992.094......|
8842
+ | 2 | POLYGON Z ((297437.539 5676992.094 -816.608, 298031.070 5678779.547......|
8843
+ | 3 | POLYGON Z ((298031.070 5678779.547 -648.688, 295827.680 5680951.574......|
8844
+ | 4 | POLYGON Z ((295827.680 5680951.574 -825.328, 297077.414 5677487.262......|
8845
+ +-------+--------------------------------------------------------------------------+
8844
8846
>>> # Merging polygons
8845
8847
>>> polygons_merged = gg.vector.unify_polygons(polygons=polygons)
8846
8848
>>> polygons_merged
8847
- geometry
8848
- 0 POLYGON Z ((396733.222 5714544.109 -186.252, 3...
8849
- 1 POLYGON Z ((390252.635 5712409.037 -543.142, 3...
8850
- 2 POLYGON Z ((391444.965 5710989.453 -516.000, 3...
8851
- 3 POLYGON Z ((388410.007 5710903.900 -85.654, 38...
8852
- 4 POLYGON Z ((384393.963 5714293.104 -614.106, 3...
8849
+ +----+--------------------------------------------------+
8850
+ | | geometry |
8851
+ +----+--------------------------------------------------+
8852
+ | 0 | POLYGON Z ((396733.222 5714544.109 -186.252, ... |
8853
+ | 1 | POLYGON Z ((390252.635 5712409.037 -543.142, ... |
8854
+ | 2 | POLYGON Z ((391444.965 5710989.453 -516.000, ... |
8855
+ | 3 | POLYGON Z ((388410.007 5710903.900 -85.654, 3... |
8856
+ | 4 | POLYGON Z ((384393.963 5714293.104 -614.106, ... |
8857
+ +----+--------------------------------------------------+
8853
8858
8854
8859
"""
8855
8860
# Checking that the polygons are of type list of a GeoDataFrame
@@ -8915,19 +8920,17 @@ def unify_linestrings(
8915
8920
Parameters
8916
8921
----------
8917
8922
linestrings : Union[List[shapely.geometry.linestring.LineString], gpd.geodataframe.GeoDataFrame]
8918
- LineStrings consisting of two vertices representing extracted contour lines
8919
-
8923
+ LineStrings consisting of two vertices representing extracted contour lines.
8920
8924
crs : Union[str, pyproj.crs.crs.CRS]
8921
- Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``
8922
-
8925
+ Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``.
8923
8926
return_gdf : bool
8924
8927
Variable to either return the data as GeoDataFrame or as list of LineStrings.
8925
- Options include: ``True`` or ``False``, default set to ``True``
8928
+ Options include: ``True`` or ``False``, default set to ``True``.
8926
8929
8927
8930
Returns
8928
8931
-------
8929
8932
linestrings_merged : Union[List[shapely.geometry.linestring.LineString], gpd.geodataframe.GeoDataFrame]
8930
- Merged Shapely LineStrings
8933
+ Merged Shapely LineStrings.
8931
8934
8932
8935
.. versionadded:: 1.0.x
8933
8936
@@ -8938,22 +8941,28 @@ def unify_linestrings(
8938
8941
>>> import geopandas as gpd
8939
8942
>>> linestrings = gpd.read_file(filename='file.shp')
8940
8943
>>> linestrings
8941
- geometry Z
8942
- 0 LINESTRING Z (32409587.930 5780538.824 -2350.0... -2350.00
8943
- 1 LINESTRING Z (32407304.336 5777048.086 -2050.0... -2050.00
8944
- 2 LINESTRING Z (32408748.977 5778005.047 -2200.0... -2200.00
8945
- 3 LINESTRING Z (32403693.547 5786613.994 -2400.0... -2400.00
8946
- 4 LINESTRING Z (32404738.664 5782672.480 -2350.0... -2350.00
8944
+ +----+--------------------------------------------------+----------+
8945
+ | | geometry | Z |
8946
+ +----+--------------------------------------------------+----------+
8947
+ | 0 | LINESTRING Z (32409587.930 5780538.824 -2350.0) | -2350.00 |
8948
+ | 1 | LINESTRING Z (32407304.336 5777048.086 -2050.0) | -2050.00 |
8949
+ | 2 | LINESTRING Z (32408748.977 5778005.047 -2200.0) | -2200.00 |
8950
+ | 3 | LINESTRING Z (32403693.547 5786613.994 -2400.0) | -2400.00 |
8951
+ | 4 | LINESTRING Z (32404738.664 5782672.480 -2350.0) | -2350.00 |
8952
+ +----+--------------------------------------------------+----------+
8947
8953
8948
8954
>>> # Merging linestrings
8949
8955
>>> polygons_linestrings = gg.vector.unify_linestrings(linestrings=linestrings)
8950
8956
>>> polygons_linestrings
8951
- geometry
8952
- 0 LINESTRING Z (32331825.641 5708789.973 -200.00...
8953
- 1 LINESTRING Z (32334315.359 5723032.766 -250.00...
8954
- 2 LINESTRING Z (32332516.312 5722028.768 -250.00...
8955
- 3 LINESTRING Z (32332712.750 5721717.561 -250.00...
8956
- 4 LINESTRING Z (32332516.312 5722028.768 -250.00...
8957
+ +----+--------------------------------------------------+
8958
+ | | geometry |
8959
+ +----+--------------------------------------------------+
8960
+ | 0 | LINESTRING Z (32331825.641 5708789.973 -200.00) |
8961
+ | 1 | LINESTRING Z (32334315.359 5723032.766 -250.00) |
8962
+ | 2 | LINESTRING Z (32332516.312 5722028.768 -250.00) |
8963
+ | 3 | LINESTRING Z (32332712.750 5721717.561 -250.00) |
8964
+ | 4 | LINESTRING Z (32332516.312 5722028.768 -250.00) |
8965
+ +----+--------------------------------------------------+
8957
8966
8958
8967
"""
8959
8968
# Checking that the linestrings are of type list of a GeoDataFrame
@@ -9016,24 +9025,23 @@ def create_hexagon(center: shapely.geometry.Point, radius: Union[int, float]):
9016
9025
Parameters
9017
9026
----------
9018
9027
center: shapely.geometry.Point
9019
- Shapely Point representing the center of the hexagon
9020
-
9028
+ Shapely Point representing the center of the hexagon.
9021
9029
radius: int, float
9022
- Radius of the hexagon
9030
+ Radius of the hexagon.
9023
9031
9024
9032
Returns
9025
9033
-------
9026
9034
geometry.Polygon(hex_coords): shapely.geometry.Polygon
9027
- Shapley Polygon in the shape of a hexagon
9035
+ Shapley Polygon in the shape of a hexagon.
9028
9036
9029
9037
.. versionadded:: 1.0.x
9030
9038
9031
9039
.. versionchanged:: 1.1.3
9032
- Optimized creation of hexagon
9040
+ Optimized creation of hexagon.
9033
9041
9034
9042
See Also
9035
9043
--------
9036
- create_hexagon_grid : Creating a hexagon grid
9044
+ create_hexagon_grid : Create a hexagon grid.
9037
9045
9038
9046
"""
9039
9047
# Checking that the center point is provided as Shapely Point
@@ -9063,19 +9071,17 @@ def create_hexagon_grid(
9063
9071
Parameters
9064
9072
----------
9065
9073
gdf: gpd.GeoDataFrame
9066
- GeoDataFrame containing the polygons for which a hexagon grid is created
9067
-
9074
+ GeoDataFrame containing the polygons for which a hexagon grid is created.
9068
9075
radius: int, float
9069
- Radius of the hexagon
9070
-
9076
+ Radius of the hexagon.
9071
9077
crop_gdf: bool
9072
- Boolean to define if the resulting GeoDataFrame should be cropped to the extend of the provided GeoDataFrame
9073
- Options include: ``True`` or ``False``, default set to ``True``
9078
+ Boolean to define if the resulting GeoDataFrame should be cropped to the extent of the provided GeoDataFrame.
9079
+ Options include: ``True`` or ``False``, default set to ``True``.
9074
9080
9075
9081
Returns
9076
9082
-------
9077
9083
hex_gdf: gpd.GeoDataFrame
9078
- GeoDataFrame containing the hexagon grid
9084
+ GeoDataFrame containing the hexagon grid.
9079
9085
9080
9086
.. versionadded:: 1.0.x
9081
9087
@@ -9084,7 +9090,7 @@ def create_hexagon_grid(
9084
9090
9085
9091
See Also
9086
9092
--------
9087
- create_hexagon : Creating one hexagon based on a given center and radius
9093
+ create_hexagon : Create one hexagon based on a given center and radius.
9088
9094
9089
9095
"""
9090
9096
# Checking that the gdf is of type GeoDataFrame
@@ -9161,12 +9167,12 @@ def create_voronoi_polygons(
9161
9167
Parameters
9162
9168
----------
9163
9169
gdf: gpd.geodataframe.GeoDataFrame
9164
- GeoDataFrame containing the Shapely Points
9170
+ GeoDataFrame containing the Shapely Points.
9165
9171
9166
9172
Returns
9167
9173
-------
9168
9174
gdf_polygons: gpd.geodataframe.GeoDataFrame
9169
- GeoDataFrame containing the valid Voronoi Polygons
9175
+ GeoDataFrame containing the valid Voronoi Polygons.
9170
9176
9171
9177
.. versionadded:: 1.1
9172
9178
@@ -9180,7 +9186,7 @@ def create_voronoi_polygons(
9180
9186
9181
9187
Note
9182
9188
----
9183
- ( https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Voronoi.html#scipy.spatial.Voronoi)
9189
+ https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Voronoi.html#scipy.spatial.Voronoi
9184
9190
9185
9191
"""
9186
9192
# Checking that the gdf is of type GeoDataFrame
0 commit comments