How to use the pygeos.lib function in pygeos

To help you get started, we’ve selected a few pygeos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pygeos / pygeos / pygeos / predicates.py View on Github external
def has_z(geometry, **kwargs):
    """Returns True if a geometry has a Z coordinate.

    Parameters
    ----------
    geometry : Geometry or array_like

    Examples
    --------
    >>> has_z(Geometry("POINT (0 0)"))
    False
    >>> has_z(Geometry("POINT Z (0 0 0)"))
    True
    """
    return lib.has_z(geometry, **kwargs)
github pygeos / pygeos / pygeos / geometry.py View on Github external
Parameters
    ----------
    geometry : Geometry or array_like

    Examples
    --------
    >>> get_num_coordinates(Geometry("POINT (0 0)"))
    1
    >>> get_num_coordinates(Geometry("POINT Z (0 0 0)"))
    1
    >>> get_num_coordinates(Geometry("GEOMETRYCOLLECTION (POINT(0 0), LINESTRING(0 0, 1 1))"))
    3
    >>> get_num_coordinates(None)
    -1
    """
    return lib.get_num_coordinates(geometry)
github pygeos / pygeos / pygeos / linear.py View on Github external
>>> line = Geometry("LINESTRING(0 2, 0 10)")
    >>> line_interpolate_point(line, 2)
    
    >>> line_interpolate_point(line, 100)
    
    >>> line_interpolate_point(line, -2)
    
    >>> line_interpolate_point(line, [0.25, -0.25], normalize=True).tolist()
    [, ]
    >>> line_interpolate_point(Geometry("LINESTRING EMPTY"), 1)
    
    """
    if normalize:
        return lib.line_interpolate_point_normalized(line, distance)
    else:
        return lib.line_interpolate_point(line, distance)
github pygeos / pygeos / pygeos / constructive.py View on Github external
This method orders the coordinates, rings of a polygon and parts of
    multi geometries consistently. Typically useful for testing purposes
    (for example in combination with `equals_exact`).

    Parameters
    ----------
    geometry : Geometry or array_like

    Examples
    --------
    >>> p = Geometry("MULTILINESTRING((0 0, 1 1),(2 2, 3 3))")
    >>> normalize(p)
    
    """
    return lib.normalize(geometry, **kwargs)
github pygeos / pygeos / pygeos / linear.py View on Github external
Examples
    --------
    >>> line = Geometry("LINESTRING(0 2, 0 10)")
    >>> line_interpolate_point(line, 2)
    
    >>> line_interpolate_point(line, 100)
    
    >>> line_interpolate_point(line, -2)
    
    >>> line_interpolate_point(line, [0.25, -0.25], normalize=True).tolist()
    [, ]
    >>> line_interpolate_point(Geometry("LINESTRING EMPTY"), 1)
    
    """
    if normalize:
        return lib.line_interpolate_point_normalized(line, distance)
    else:
        return lib.line_interpolate_point(line, distance)
github pygeos / pygeos / pygeos / io.py View on Github external
The defaults differ from the default of the GEOS library. To mimic this,
    use::

        to_wkt(geometry, rounding_precision=-1, trim=False, output_dimension=2)

    """
    if not np.isscalar(rounding_precision):
        raise TypeError("rounding_precision only accepts scalar values")
    if not np.isscalar(trim):
        raise TypeError("trim only accepts scalar values")
    if not np.isscalar(output_dimension):
        raise TypeError("output_dimension only accepts scalar values")
    if not np.isscalar(old_3d):
        raise TypeError("old_3d only accepts scalar values")

    return lib.to_wkt(
        geometry,
        np.intc(rounding_precision),
        np.bool(trim),
        np.intc(output_dimension),
        np.bool(old_3d),
        **kwargs,
    )