{"id":240,"date":"2021-06-22T15:29:03","date_gmt":"2021-06-22T13:29:03","guid":{"rendered":"https:\/\/cavaliers23.fr\/france2020\/?p=240"},"modified":"2021-06-25T18:58:17","modified_gmt":"2021-06-25T16:58:17","slug":"test-geojson","status":"publish","type":"post","link":"https:\/\/cavaliers23.fr\/france2020\/index.php\/2021\/06\/22\/test-geojson\/","title":{"rendered":"Test geojson"},"content":{"rendered":"<p>Test de chargement d&rsquo;un fichier geojson et d&rsquo;un marqueur avec lien :<br \/>\n<div class=\"leaflet-map WPLeafletMap\" style=\"height:600px; width:100%;\"><\/div><script>\nwindow.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];\nwindow.WPLeafletMapPlugin.push(function WPLeafletMapShortcode() {\/*<script>*\/\nvar baseUrl = atob('aHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmc=');\nvar base = (!baseUrl && window.MQ) ?\n    window.MQ.mapLayer() : L.tileLayer(baseUrl,\n        L.Util.extend({}, {\n            detectRetina: 0,\n        },\n        {\"subdomains\":\"abc\",\"noWrap\":false,\"maxZoom\":20}        )\n    );\n    var options = L.Util.extend({}, {\n        layers: [base],\n        attributionControl: false\n    },\n    {\"zoomControl\":true,\"scrollWheelZoom\":true,\"doubleClickZoom\":false,\"fitBounds\":true,\"minZoom\":0,\"maxZoom\":20,\"maxBounds\":null,\"attribution\":\"<a href=\\\"http:\\\/\\\/leafletjs.com\\\" title=\\\"Une biblioth\\u00e8que JS pour des cartes interactives\\\">Leaflet<\\\/a>; \\u00a9 <a href=\\\"http:\\\/\\\/www.openstreetmap.org\\\/copyright\\\">OpenStreetMap<\\\/a> contributeurs\"},\n    {});\nwindow.WPLeafletMapPlugin.createMap(options).setView([46.57,0.3404608],15);});<\/script><br \/>\n<script>\nwindow.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];\nwindow.WPLeafletMapPlugin.push(function WPLeafletMarkerShortcode() {\/*<script>*\/\nvar map = window.WPLeafletMapPlugin.getCurrentMap();\nvar group = window.WPLeafletMapPlugin.getCurrentGroup();\nvar marker_options = window.WPLeafletMapPlugin.getIconOptions({});\nvar marker = L.marker(\n    [46.571783696226,0.39104264264362],\n    marker_options\n);\nvar is_image = map.is_image_map;\nif (marker_options.draggable) {\n    marker.on('dragend', function () {\n        var latlng = this.getLatLng();\n        var lat = latlng.lat;\n        var lng = latlng.lng;\n        if (is_image) {\n            console.log('leaflet-marker y=' + lat + ' x=' + lng);\n        } else {\n            console.log('leaflet-marker lat=' + lat + ' lng=' + lng);\n        }\n    });\n}\nmarker.addTo( group );\nmarker.bindPopup(window.WPLeafletMapPlugin.unescape('Disney World! &lt;a href=&quot;https:\/\/google.com&quot;&gt;Google&lt;\/a&gt; '));window.WPLeafletMapPlugin.markers.push( marker );\n        });<\/script><br \/>\n<script>\nwindow.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];\nwindow.WPLeafletMapPlugin.push(function WPLeafletjsonShortcode() {\/*<script>*\/\nvar src = 'https:\/\/cavaliers23.fr\/france2020\/wp-content\/uploads\/2021\/06\/test.geojson';\nvar default_style = {};\nvar rewrite_keys = {\n    stroke : 'color',\n    'stroke-width' : 'weight',\n    'stroke-opacity' : 'opacity',\n    fill : 'fillColor',\n    'fill-opacity' : 'fillOpacity',\n};\n\/\/ htmlspecialchars converts & to \"&amp;\"; maybe unnecessarily, and maybe 3x\nvar ampersandRegex = \/&(?:amp;){1,3}\/g\nvar layer = L.ajaxGeoJson(src.replace(ampersandRegex, '&'), {\n    type: 'json',\n    style : layerStyle,\n    onEachFeature : onEachFeature,\n    pointToLayer: pointToLayer\n});\nvar fitbounds = 0;\nvar circleMarker = 0;\nvar popup_text = window.WPLeafletMapPlugin.unescape(\"\");\nvar popup_property = \"\";\nvar table_view = 0;\nvar group = window.WPLeafletMapPlugin.getCurrentGroup();\nvar markerOptions = window.WPLeafletMapPlugin.getIconOptions({});\nlayer.addTo( group );\nwindow.WPLeafletMapPlugin.geojsons.push( layer );\nif (fitbounds) {\n    layer.on('ready', function () {\n        this.map.fitBounds( this.getBounds() );\n    });\n}\nfunction layerStyle (feature) {\n    var props = feature.properties || {};\n    var style = {};\n    function camelFun (_, first_letter) {\n        return first_letter.toUpperCase();\n    };\n    for (var key in props) {\n        if (key.match('-')) {\n            var camelcase = key.replace(\/-(\\w)\/, camelFun);\n            style[ camelcase ] = props[ key ];\n        }\n        \/\/ rewrite style keys from geojson.io\n        if (rewrite_keys[ key ]) {\n            style[ rewrite_keys[ key ] ] = props[ key ];\n        }\n    }\n    return L.Util.extend(style, default_style);\n}\nfunction onEachFeature (feature, layer) {\n    var props = feature.properties || {};\n    var text;\n    if (table_view) {\n        text = window.WPLeafletMapPlugin.propsToTable(props);\n    } else {\n        text = popup_property\n            ? props[ popup_property ]\n            : window.WPLeafletMapPlugin.template(\n                popup_text, \n                feature.properties\n            );\n    }\n    if (text) {\n        layer.bindPopup( text );\n    }\n}\n    function pointToLayer (feature, latlng) {\n    if (circleMarker) {\n        return L.circleMarker(latlng);\n    }\n    return L.marker(latlng, markerOptions);\n}});<\/script><br \/>\n<br \/>\n<div class=\"leaflet-map WPLeafletMap\" style=\"height:600px; width:100%;\"><\/div><script>\nwindow.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];\nwindow.WPLeafletMapPlugin.push(function WPLeafletMapShortcode() {\/*<script>*\/\nvar baseUrl = atob('aHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmc=');\nvar base = (!baseUrl && window.MQ) ?\n    window.MQ.mapLayer() : L.tileLayer(baseUrl,\n        L.Util.extend({}, {\n            detectRetina: 0,\n        },\n        {\"subdomains\":\"abc\",\"noWrap\":false,\"maxZoom\":20}        )\n    );\n    var options = L.Util.extend({}, {\n        layers: [base],\n        attributionControl: false\n    },\n    {\"zoomControl\":true,\"scrollWheelZoom\":true,\"doubleClickZoom\":false,\"fitBounds\":true,\"minZoom\":0,\"maxZoom\":20,\"maxBounds\":null,\"attribution\":\"<a href=\\\"http:\\\/\\\/leafletjs.com\\\" title=\\\"Une biblioth\\u00e8que JS pour des cartes interactives\\\">Leaflet<\\\/a>; \\u00a9 <a href=\\\"http:\\\/\\\/www.openstreetmap.org\\\/copyright\\\">OpenStreetMap<\\\/a> contributeurs\"},\n    {});\nwindow.WPLeafletMapPlugin.createMap(options).setView([46.57,0.3404608],15);});<\/script><br \/>\n<script>\nwindow.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];\nwindow.WPLeafletMapPlugin.push(function WPLeafletjsonShortcode() {\/*<script>*\/\nvar src = 'https:\/\/cavaliers23.fr\/france2020\/wp-content\/uploads\/2021\/06\/departements_2.geojson';\nvar default_style = {};\nvar rewrite_keys = {\n    stroke : 'color',\n    'stroke-width' : 'weight',\n    'stroke-opacity' : 'opacity',\n    fill : 'fillColor',\n    'fill-opacity' : 'fillOpacity',\n};\n\/\/ htmlspecialchars converts & to \"&amp;\"; maybe unnecessarily, and maybe 3x\nvar ampersandRegex = \/&(?:amp;){1,3}\/g\nvar layer = L.ajaxGeoJson(src.replace(ampersandRegex, '&'), {\n    type: 'json',\n    style : layerStyle,\n    onEachFeature : onEachFeature,\n    pointToLayer: pointToLayer\n});\nvar fitbounds = 0;\nvar circleMarker = 0;\nvar popup_text = window.WPLeafletMapPlugin.unescape(\"\");\nvar popup_property = \"\";\nvar table_view = 0;\nvar group = window.WPLeafletMapPlugin.getCurrentGroup();\nvar markerOptions = window.WPLeafletMapPlugin.getIconOptions({});\nlayer.addTo( group );\nwindow.WPLeafletMapPlugin.geojsons.push( layer );\nif (fitbounds) {\n    layer.on('ready', function () {\n        this.map.fitBounds( this.getBounds() );\n    });\n}\nfunction layerStyle (feature) {\n    var props = feature.properties || {};\n    var style = {};\n    function camelFun (_, first_letter) {\n        return first_letter.toUpperCase();\n    };\n    for (var key in props) {\n        if (key.match('-')) {\n            var camelcase = key.replace(\/-(\\w)\/, camelFun);\n            style[ camelcase ] = props[ key ];\n        }\n        \/\/ rewrite style keys from geojson.io\n        if (rewrite_keys[ key ]) {\n            style[ rewrite_keys[ key ] ] = props[ key ];\n        }\n    }\n    return L.Util.extend(style, default_style);\n}\nfunction onEachFeature (feature, layer) {\n    var props = feature.properties || {};\n    var text;\n    if (table_view) {\n        text = window.WPLeafletMapPlugin.propsToTable(props);\n    } else {\n        text = popup_property\n            ? props[ popup_property ]\n            : window.WPLeafletMapPlugin.template(\n                popup_text, \n                feature.properties\n            );\n    }\n    if (text) {\n        layer.bindPopup( text );\n    }\n}\n    function pointToLayer (feature, latlng) {\n    if (circleMarker) {\n        return L.circleMarker(latlng);\n    }\n    return L.marker(latlng, markerOptions);\n}});<\/script><br \/>\n<br \/>\n<div class=\"leaflet-map WPLeafletMap\" style=\"height:600px; width:100%;\"><\/div><script>\nwindow.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];\nwindow.WPLeafletMapPlugin.push(function WPLeafletMapShortcode() {\/*<script>*\/\nvar baseUrl = atob('aHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmc=');\nvar base = (!baseUrl && window.MQ) ?\n    window.MQ.mapLayer() : L.tileLayer(baseUrl,\n        L.Util.extend({}, {\n            detectRetina: 0,\n        },\n        {\"subdomains\":\"abc\",\"noWrap\":false,\"maxZoom\":20}        )\n    );\n    var options = L.Util.extend({}, {\n        layers: [base],\n        attributionControl: false\n    },\n    {\"zoomControl\":true,\"scrollWheelZoom\":true,\"doubleClickZoom\":false,\"fitBounds\":true,\"minZoom\":0,\"maxZoom\":20,\"maxBounds\":null,\"attribution\":\"<a href=\\\"http:\\\/\\\/leafletjs.com\\\" title=\\\"Une biblioth\\u00e8que JS pour des cartes interactives\\\">Leaflet<\\\/a>; \\u00a9 <a href=\\\"http:\\\/\\\/www.openstreetmap.org\\\/copyright\\\">OpenStreetMap<\\\/a> contributeurs\"},\n    {});\nwindow.WPLeafletMapPlugin.createMap(options).setView([46.57,0.3404608],15);});<\/script><br \/>\n<script>\nwindow.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];\nwindow.WPLeafletMapPlugin.push(function WPLeafletLineShortcode() {\/*<script>*\/\nvar previous_map = window.WPLeafletMapPlugin.getCurrentMap();\nvar group = window.WPLeafletMapPlugin.getCurrentGroup();\nvar shape = L.polygon([[\"25.7741728\",\"-80.19362\"],[\"18.465299\",\"-66.116666\"],[\"32.3018217\",\"-64.7603583\"]], {\"color\":\"green\",\"fillColor\":\"yellow\"});\nvar fitbounds = 0;\nshape.addTo( group );\nif (fitbounds) {\n    \/\/ zoom the map to the shape\n    previous_map.fitBounds( shape.getBounds() );\n}\nshape.bindPopup(window.WPLeafletMapPlugin.unescape('Bermuda Triangle'));window.WPLeafletMapPlugin.polygons.push( shape );});<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Test de chargement d&rsquo;un fichier geojson et d&rsquo;un marqueur avec lien :<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-240","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/posts\/240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/comments?post=240"}],"version-history":[{"count":25,"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/posts\/240\/revisions"}],"predecessor-version":[{"id":268,"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/posts\/240\/revisions\/268"}],"wp:attachment":[{"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/media?parent=240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/categories?post=240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cavaliers23.fr\/france2020\/index.php\/wp-json\/wp\/v2\/tags?post=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}