Polygon collation for the Rust geo types.
Polygon collation is converting an unorganized set of closed LineStrings, and organizing them into a set of Polygons. This isn't trivial, because you have to identify which LineStrings are holes, and which are exteriors, and which holes belong to which exteriors.
let exterior1: LineString<i64> = vec![(0, 0), (0, 30), (30, 30), (30, 0), (0, 0)].into();
let hole1: LineString<i64> = vec![(10, 10), (20, 10), (20, 20), (10, 20), (10, 10)].into();
let exterior2: LineString<i64> = exterior1.translate(40, 0);
let hole2: LineString<i64> = hole1.translate(40, 0);
let uncollated: MultiLineString<i64> = (vec![exterior1, hole1, exterior2, hole2])
.into_iter()
.collect();
let collated: MultiPolygon<i64> = uncollated.collate().unwrap();