From d8d5d3cc2993964580b76cc3030c8989cd625389 Mon Sep 17 00:00:00 2001 From: Pascal Vuylsteker Date: Thu, 7 Apr 2022 16:14:54 +0200 Subject: [PATCH] onEachFeature des Departement Rajout d'une fonction popup (bindPopup) --- index.html | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index d68c75b..6c4c0ee 100644 --- a/index.html +++ b/index.html @@ -85,17 +85,37 @@

Pour aller plus loin

attribution: 'Map data © OpenStreetMap contributors,'}).addTo(map); //Ajout du layer GeoJSON Département - var DEPARTEMENTS = L.geoJson(deps_idf, { + // var DEPARTEMENTS = L.geoJson(deps_idf, { + // style: function (feature) { + // return { + // weight: feature.properties.radius_qgis2leaf, + // color: feature.properties.color_qgis2leaf, + // opacity: feature.properties.transp_qgis2leaf, + // fillOpacity: feature.properties.transp_qgis2leaf + // }; + // } + // }); + // DEPARTEMENTS.addTo(map); + + + // DEPARTEMENTS + //fonction popup + function onEachFeature(feature, layer) { + if (feature.properties) { + layer.bindPopup("" + feature.properties.CODE_DEPT + "
" + feature.properties.NOM_DEPT); + } + } + //Ajout du layer GeoJSON Departements IDF + var deps_idf_var = new L.geoJson(deps_idf,{ + onEachFeature: onEachFeature, style: function (feature) { - return { - weight: feature.properties.radius_qgis2leaf, - color: feature.properties.color_qgis2leaf, - opacity: feature.properties.transp_qgis2leaf, - fillOpacity: feature.properties.transp_qgis2leaf - }; - } - }); - DEPARTEMENTS.addTo(map); + return {color: feature.properties.border_color_qgis2leaf, + fillColor: feature.properties.color_qgis2leaf, + weight: feature.properties.radius_qgis2leaf, + opacity: feature.properties.transp_qgis2leaf, + fillOpacity: feature.properties.transp_qgis2leaf}; + } }); + deps_idf_var.addTo(map); L.geoJson(RERA, { }).addTo(map); //Ajout du layer GeoJSON RER A @@ -209,13 +229,6 @@

Pour aller plus loin

airports.addTo(map); -//fonction popup -function onEachFeature(feature, layer) { - if (feature.properties) { - layer.bindPopup("" + feature.properties.CODE_DEPT + "
" + feature.properties.NOM_DEPT); - } -} -