explode method
explode the MultiPolygon into a List of Points.
Example:
MultiPolygon([
[
LinearRing([Coordinate(1, 2), Coordinate(3, 4), Coordinate(5, 6), Coordinate(1, 2)])
],
[
LinearRing([Coordinate(7, 8), Coordinate(9, 10), Coordinate(11, 12), Coordinate(7, 8)])
]
]).explode(); // [Point(1, 2), Point(3, 4), Point(5, 6), Point(1, 2), Point(7, 8), Point(9, 10), Point(11, 12), Point(7, 8)]
Implementation
@override
List<Point> explode() {
final explodedFeatures = <Point>[];
for (final poly in coordinates) {
explodedFeatures.addAll(poly
.map((ring) => ring.coordinates.map((cord) => Point(cord)).toList())
.toList()
.expand((i) => i)
.toList());
}
return explodedFeatures;
}