From a42650fb32fb75953f00e115faf3b661ff9ea627 Mon Sep 17 00:00:00 2001
From: jshjelse <jshjelse@stud.ntnu.no>
Date: Mon, 23 Oct 2023 15:49:53 +0200
Subject: [PATCH] Bugfix

---
 javascript/buffer.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/javascript/buffer.js b/javascript/buffer.js
index f137885..3e7e753 100644
--- a/javascript/buffer.js
+++ b/javascript/buffer.js
@@ -36,6 +36,11 @@ function makeBuffer() {
         var buffer = turf.buffer(layer, distance, {units: "meters"}); // Lager buffer
         
         if (document.getElementById("bufferCheck").checked) { // Om en har huket av for at en skal 'dissolve' gjøres det
+            // Dette er nytt
+            if (isMultiPolygon(buffer)) { // Kan ikke sende MultiPolygon inn i dissolved
+                buffer = multiPolygonToFeatureCollection(buffer);
+            }
+            // #
             var dissolved = turf.dissolve(buffer);
             var newLayer = L.geoJSON(dissolved, {style: getStyle()});
         } else { // Ellers lager den bare mange ulike buffer-soner
-- 
GitLab