Skip to content

Commit afedf6b

Browse files
Format create_linestring_from_xyz_points
1 parent 75e4a11 commit afedf6b

File tree

1 file changed

+35
-10
lines changed

1 file changed

+35
-10
lines changed

gemgis/vector.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3354,35 +3354,46 @@ def create_linestring_from_xyz_points(
33543354
zcol: str = "Z",
33553355
drop_nan: bool = True,
33563356
) -> shapely.geometry.linestring.LineString:
3357-
"""
3358-
Create LineString from an array or GeoDataFrame containing X, Y, and Z coordinates of points.
3357+
"""Create LineString from an array or GeoDataFrame containing X, Y, and Z coordinates of points.
33593358
33603359
Parameters
33613360
__________
33623361
points : Union[np.ndarray, gpd.geodataframe.GeoDataFrame]
33633362
NumPy Array or GeoDataFrame containing XYZ points.
3364-
nodata : Union[int, float])
3363+
3364+
+----+-------+-------+-------+
3365+
| | X | Y | Z |
3366+
+----+-------+-------+-------+
3367+
| 0 | 3.23 | 5.69 | 2.03 |
3368+
+----+-------+-------+-------+
3369+
| 1 | 3.24 | 5.68 | 2.02 |
3370+
+----+-------+-------+-------+
3371+
| 2 | 3.25 | 5.67 | 1.97 |
3372+
+----+-------+-------+-------+
3373+
| 3 | 3.26 | 5.66 | 1.95 |
3374+
+----+-------+-------+-------+
3375+
3376+
nodata : Union[int, float]), default: ``9999.0``
33653377
Nodata value to filter out points outside a designated area, e.g. ``nodata=9999.0``, default is ``9999.0``.
3366-
xcol : str
3378+
xcol : str, default: ``'X'``
33673379
Name of the X column in the dataset, e.g. ``xcol='X'``, default is ``'X'``.
3368-
ycol : str
3380+
ycol : str, default: ``'Y'``
33693381
Name of the Y column in the dataset, e.g. ``ycol='Y'``, default is ``'Y'``.
3370-
zcol : str
3382+
zcol : str, default: ``'Z'``
33713383
Name of the Z column in the dataset, e.g. ``zcol='Z'``, default is ``'Z'``.
3372-
drop_nan : bool
3384+
drop_nan : bool, default: ``True``
33733385
Boolean argument to drop points that contain a ``nan`` value as Z value. Options include ``True`` and
33743386
``False``, default is ``True``.
33753387
33763388
Returns
33773389
_______
33783390
33793391
line : shapely.geometry.linestring.LineString
3380-
LineString Z constructed from provided point values
3392+
LineString Z constructed from provided point values.
33813393
33823394
.. versionadded:: 1.0.x
33833395
3384-
.. versionchanged:: 1.1
3385-
Adding argument `drop_nan` and code to drop coordinates that contain ``nan`` values as Z coordinates.
3396+
.. versionchanged:: 1.2
33863397
33873398
Example
33883399
_______
@@ -3391,6 +3402,20 @@ def create_linestring_from_xyz_points(
33913402
>>> import gemgis as gg
33923403
>>> import numpy as np
33933404
>>> points = np.array([[3.23, 5.69, 2.03],[3.24, 5.68, 2.02],[3.25, 5.67, 1.97],[3.26, 5.66, 1.95]])
3405+
>>> points
3406+
3407+
+----+-------+-------+-------+
3408+
| | X | Y | Z |
3409+
+----+-------+-------+-------+
3410+
| 0 | 3.23 | 5.69 | 2.03 |
3411+
+----+-------+-------+-------+
3412+
| 1 | 3.24 | 5.68 | 2.02 |
3413+
+----+-------+-------+-------+
3414+
| 2 | 3.25 | 5.67 | 1.97 |
3415+
+----+-------+-------+-------+
3416+
| 3 | 3.26 | 5.66 | 1.95 |
3417+
+----+-------+-------+-------+
3418+
33943419
33953420
>>> # Creating LineStrings from points
33963421
>>> linestring = gg.vector.create_linestring_from_xyz_points(points=points)

0 commit comments

Comments
 (0)