rust-geo-repair-polygon
A package containing:
- a trait for (Multi)Polygon that attempts repairing a geo-types (Multi)Polygon that is invalid according to
geo-validator
. - a trait for MultiPolygon that merges all of its Polygons into a single valid Polygon
Repair (MultiPolygon/Polygon)
When running repair, it will try its best to produce a (Multi)Polygon that meets OGC standards. Some very invalid polygons may still fail, but most come through as valid with very little change.
Example
use Repair;
use polygon;
let bowtie = polygon!;
let expected = polygon!;
let repaired_bowtie = bowtie.repair;
assert!;
assert_eq!;
Join (MultiPolygon)
The join trait for MultiPolygon will merge all of its Polygons into a single valid Polygon. This may involve a union or the creation of a small bridge between the closest points of non-overlapping Polygons.
Example
use Join;
use ;
let separate_polygons: = vec!.into;
let expected = polygon!;
let merged = separate_polygons.join;
assert_eq!;