From 3ecd505dde44e6320d4df3b7dd8e52c8c28a7257 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Fri, 17 Dec 2021 13:11:59 -0800 Subject: [PATCH] parseFloat fix for toFixed, also 5 not 6, closes #9 --- datasette_leaflet_freedraw/static/datasette-leaflet-freedraw.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasette_leaflet_freedraw/static/datasette-leaflet-freedraw.js b/datasette_leaflet_freedraw/static/datasette-leaflet-freedraw.js index d9e1a7e..c3a9602 100644 --- a/datasette_leaflet_freedraw/static/datasette-leaflet-freedraw.js +++ b/datasette_leaflet_freedraw/static/datasette-leaflet-freedraw.js @@ -108,7 +108,7 @@ function configureMap(input) { let geojson = { type: "MultiPolygon", coordinates: event.latLngs.map((shape) => [ - shape.map((p) => [p.lng.toFixed(6), p.lat.toFixed(6)]), + shape.map((p) => [parseFloat(p.lng.toFixed(5)), parseFloat(p.lat.toFixed(5))]), ]), }; input.value = JSON.stringify(geojson);