clean_polygons

Function clean_polygons 

Source
pub fn clean_polygons<P: FullXY>(
    polygons: &[Vec<Vec<P>>],
    remove_collinear_points: bool,
    clean_wgs84: bool,
) -> Option<(Vec<Vec<Vec<P>>>, BBox)>
Expand description

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 remove_collinear_points

§Parameters

  • polygons: the collection of polygon as either a VectorFeature, VectorMultiPolygonGeometry, or raw VectorMultiPolygon
  • remove_collinear_points: - if true, remove superfluous points
  • clean_wgs84: if true, clean WGS84 points to be valid WGS84 points

§Returns

The cleaned polygons as a new collection of polygons