pub fn clean_polygon<P: FullXY>(
polygon: &[Vec<P>],
remove_collinear_points: bool,
clean_wgs84: bool,
) -> Option<(Vec<Vec<Vec<P>>>, BBox)>Expand description
Ensures the 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
polygon: the polygon as either a VectorFeature, VectorPolygonGeometry, or raw VectorPolygonremove_collinear_points: if true, remove superfluous pointsclean_wgs84: if true, clean WGS84 points to be valid WGS84 points
§Returns
The cleaned polygon, split into a multi-polygon as necessary