Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getGeojsonCoors (geojson, debug=false) {
let result;
if (geojson.features) { // for feature collections
// make sure that if any polygons are overlapping, we get the union of them
geojson = combine(geojson);
// turf adds extra arrays when running combine, so we need to remove them
// as we return the coordinates
result = geojson.features[0].geometry.coordinates
.map(coors => coors[0]);
} else if (geojson.geometry) { // for individual feature
result = geojson.geometry.coordinates;
} else if (geojson.coordinates) { // for just the geometry
result = geojson.coordinates;
}
return result;
},