gis-tools-ts - v0.6.0
    Preparing search index...

    Function cleanPolygons

    • Ensures the collection of polygon ring order is correct, removes duplicate points, and runs a dekink to be thorough.

      NOTE: This will not remove/reduce points that follow a path angle like [[0, 0], [0, 1], [0, 2], ...]. The decision to leave this to the user is due to the fact that not all projections are guaranteed to support a linear relationship. Also sometimes the user want's to have these extra points for future/cleaner projection changes. For example, having higher precision works well when translating to spherical projections for instance. If you do want to remove these points, pass in true to removeCollinearPoints

      Type Parameters

      • M = Record<string, unknown>
      • D extends Properties = Properties
      • P extends Properties = Properties

      Parameters

      • polygons:
            | VectorMultiPolygon<D>
            | VectorMultiPolygonGeometry<D>
            | VectorFeatures<M, D, P, VectorMultiPolygonGeometry<D>>

        the collection of polygon as either a VectorFeature, VectorMultiPolygonGeometry, or raw VectorMultiPolygon

      • removeCollinearPoints: boolean = false

        if true, remove superfluous points

      • cleanWGS84: boolean = false

        if true, clean WGS84 points to be in bounds

      Returns VectorMultiPolygonGeometry<D> | undefined

      • the cleaned polygon