diff --git a/GeofenceGenerator/GeofenceGenerator.js b/GeofenceGenerator/GeofenceGenerator.js index e1540436..79e4cbfd 100644 --- a/GeofenceGenerator/GeofenceGenerator.js +++ b/GeofenceGenerator/GeofenceGenerator.js @@ -25,6 +25,7 @@ async function request() { polygons[i].remove() } polygons = [] + features = [] // Remove crop polygon and enable button its button if (crop_polygon != null) { @@ -154,6 +155,10 @@ function apply_crop() { // Apply to all features const crop_JSON = crop_polygon.toGeoJSON() for (const feature of features) { + if ((feature.geometry.type != "Polygon") && (feature.geometry.type != "MultiPolygon")) { + // Only polygons can be cropped, the others are not displayed + continue + } const cropped = turf.intersect(feature, crop_JSON) if (cropped != null) { cropped.id = feature.id, @@ -230,7 +235,8 @@ async function generate_fence(feature, name) { // Convert to cartesian const cartesian = { x: new Array(len), y: new Array(len) } for (let i = 0; i