curviriver.curvilinear
======================

.. py:module:: curviriver.curvilinear

.. autoapi-nested-parse::

   Generate curvilinear mesh from a polygon.

   ..
       !! processed by numpydoc !!




Module Contents
---------------

.. py:function:: line_extension(line, poly, both_ends = True)

   
   Extend a line to the boundary of a (multi)polygon.

   :Parameters: * **line** (:class:`shapely.LineString`) -- Line to be extended.
                * **poly** (:class:`shapely.Polygon` or :class:`shapely.MultiPolygon`) -- Polygon to which the line will be extended.
                * **both_ends** (:class:`bool`, *optional*) -- Whether to extend both ends of the line, defaults to ``True``.

   :returns: :class:`shapely.LineString` -- Extended line.















   ..
       !! processed by numpydoc !!

.. py:function:: line_xsection(line, distance, width, crs)

   
   Get cross-sections along the line at a given spacing.

   :Parameters: * **line** (:class:`shapely.LineString`) -- A line along which the cross-sections will be generated.
                * **distance** (:class:`float`) -- The distance between two consecutive cross-sections.
                * **width** (:class:`float`) -- The width of the cross-section.
                * **crs** (:class:`str` or :class:`int` or :class:`pyproj.CRS`) -- The CRS of the input line. Using projected CRS is highly recommended.

   :returns: :class:`geopandas.GeoSeries` -- Cross-sections along the line, sorted by line direction.















   ..
       !! processed by numpydoc !!

.. py:function:: poly_centerline(geometry)

   
   Create centerline from a polygon.

   This function is based on the
   `Centerline <https://github.com/fitodic/centerline>`__
   package (MIT License).

   :Parameters: **geometry** (:class:`shapely.Polygon` or :class:`shapely.MultiPolygon`) -- Input geometry which can be either ``Polygon``` or ``MultiPolygon``.

   :returns: :class:`shapely.LineString` -- Centerline of the input geometry















   ..
       !! processed by numpydoc !!

.. py:function:: poly_segmentize(poly, crs, spacing_streamwise, xs_npts)

   
   Segmentize a polygon into a curvilinear grid.

   :Parameters: * **poly** (:class:`shapely.Polygon`) -- Polygon to convert to a grid of transects.
                * **crs** (:class:`int`, :class:`str`, or :class:`pyproj.CRS`) -- Coordinate reference system of the polygon. Using projected CRS is
                  highly recommended.
                * **spacing_streamwise** (:class:`float`) -- Spacing between cross-sections along the polygon's centerline.
                * **xs_npts** (:class:`int`) -- Number of points along each cross-section.

   :returns: :class:`gpd.GeoSeries` -- Cross-sections as a GeoSeries of LineStrings.















   ..
       !! processed by numpydoc !!

