From 115535302cb611359d2292086563dec09db0e407 Mon Sep 17 00:00:00 2001 From: ninjasoturi <52629375+Ninjasoturi@users.noreply.github.com> Date: Sun, 29 May 2022 13:50:25 +0200 Subject: [PATCH] Edited poracleToGeoJSON.js to check for coordinate format If the first and last coordinates of a polygon aren't identical, add the first coordinates to the end --- server/scripts/poracleToGeoJSON.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/scripts/poracleToGeoJSON.js b/server/scripts/poracleToGeoJSON.js index 24ed4e23a..1c4bdbd7d 100644 --- a/server/scripts/poracleToGeoJSON.js +++ b/server/scripts/poracleToGeoJSON.js @@ -48,6 +48,10 @@ if (fs.existsSync(geofencesFile)) { const coord = inGeofence.path[j] inGeofence.path[j] = [coord[1], coord[0]] } + const lastCoords = inGeofence.path.slice(-1) + if (inGeofence.path[0][0] !== lastCoords[0][0] || inGeofence.path[0][1] !== lastCoords[0][1]) { + inGeofence.path.push(inGeofence.path[0]) + } outGeofence.geometry.coordinates[0] = inGeofence.path outGeoJSON.features.push(outGeofence) }