How to use the simplification.util._CoordResult function in simplification

To help you get started, we’ve selected a few simplification 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 urschrei / simplification / simplification / util.py View on Github external
Simplify a LineString using the Ramer-Douglas-Peucker algorithm.
    Input: a list of lat, lon coordinates, and an epsilon float (Try 1.0 to begin with, reducing by orders of magnitude)
    Output: a simplified list of coordinates

    Example:
    simplify_coords([
        [0.0, 0.0], [5.0, 4.0], [11.0, 5.5], [17.3, 3.2], [27.8, 0.1]],
        1.0
    )
    Result: [[0.0, 0.0], [5.0, 4.0], [11.0, 5.5], [27.8, 0.1]]

    """

simplify_coords_vw = lib.simplify_visvalingam_ffi
simplify_coords_vw.argtypes = (_FFIArray, c_double)
simplify_coords_vw.restype = _CoordResult
simplify_coords_vw.errcheck = _void_array_to_nested_list
simplify_coords_vw.__doc__ = """
    Simplify a LineString using the Visvalingam-Whyatt algorithm.
    Input: a list of lat, lon coordinates, and an epsilon float
    Output: a simplified list of coordinates

    Example:
    simplify_coords([
        [5.0, 2.0], [3.0, 8.0], [6.0, 20.0], [7.0, 25.0], [10.0, 10.0]],
        30.0
    )
    Result: [[5.0, 2.0], [7.0, 25.0], [10.0, 10.0]]

    """

simplify_coords_vwp = lib.simplify_visvalingamp_ffi

simplification

Fast linestring simplification using RDP or Visvalingam-Whyatt and a Rust binary

MIT
Latest version published 1 month ago

Package Health Score

76 / 100
Full package analysis