in src/lib/components/molecules/canvas-map/lib/Feature.js [116:139]
_getGeometryGeoJSON() {
const geometries = this.geometries.map((d) => d.getGeoJSON())
if (geometries.length === 0) throw new Error("Feature has no geometries")
if (geometries.length === 1) return geometries[0]
if (geometries[0].type === "Polygon") {
return {
type: "MultiPolygon",
coordinates: geometries.map((d) => d.coordinates),
}
} else if (geometries[0].type === "LineString") {
return {
type: "MultiLineString",
coordinates: geometries.map((d) => d.coordinates),
}
} else if (geometries[0].type === "Point") {
return {
type: "MultiPoint",
coordinates: geometries.map((d) => d.coordinates),
}
}
throw new Error("Could not determine geometry type")
}