From 2714faeb3fd8ee6634c7d36af092f18b69442cbf Mon Sep 17 00:00:00 2001 From: Hadrien Lemaire <61823459+hadrienlemaire@users.noreply.github.com> Date: Mon, 15 Aug 2022 01:03:16 +0200 Subject: [PATCH 1/2] Add id to geojson path --- lib/jekyll-leaflet/leaflet-map.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/jekyll-leaflet/leaflet-map.js b/lib/jekyll-leaflet/leaflet-map.js index 40e5922..64e6b4e 100644 --- a/lib/jekyll-leaflet/leaflet-map.js +++ b/lib/jekyll-leaflet/leaflet-map.js @@ -120,7 +120,11 @@ } geojson.addTo(map); - + + for(var i=0; i Date: Sun, 28 Aug 2022 15:48:27 +0200 Subject: [PATCH 2/2] doc for id of geojson --- docs/getting-started.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 1f058b5..60fefe0 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -51,7 +51,7 @@ This tag block takes in 1 positional argument, a JSON object. This object can sp {} {% endleaflet_map %} -You can place any number of "leafet items" inbetween the `leaflet_map` tag blocks. At minimum, there must at least be an empty object `{}` in between the tag blocks, or else the map won't draw at all. Leaflet items include markers, geometries, geojson, features, popups, etc. Each leaflet item tag also takes in a single JSON object positional argument. In this example, we will be drawing 1 marker and 1 Polygon on a map. +You can place any number of "leafet items" inbetween the `leaflet_map` tag blocks. At minimum, there must at least be an empty object `{}` in between the tag blocks, or else the map won't draw at all. Leaflet items include markers, geometries, geojson, features, popups, etc. Each leaflet item tag also takes in a single JSON object positional argument. If an `id` key is present inside the `properties` object, its content will be used as the id of the ̀` tag which represent the geojson element on the map. In this example, we will be drawing 1 marker and 1 Polygon on a map. {% raw %} ```liquid @@ -65,7 +65,8 @@ You can place any number of "leafet items" inbetween the `leaflet_map` tag block {% leaflet_geojson { "type": "Feature", "properties": { "popupContent": "The whole state of North Dakota", - "href": "https://nd.gov" }, + "href": "https://nd.gov", + "id": "area-north-dakota" }, "geometry": { "type": "Polygon", "coordinates": [[ @@ -89,7 +90,8 @@ You can place any number of "leafet items" inbetween the `leaflet_map` tag block {% leaflet_geojson { "type": "Feature", "properties": { "popupContent": "The whole state of North Dakota", - "href": "https://nd.gov" }, + "href": "https://nd.gov", + "id": "area-north-dakota" }, "geometry": { "type": "Polygon", "coordinates": [[