1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| function utiliserLaReponse(json) {
alert(json.features[0].type)
}
//la lecture du fichier
var xhttp;
if (window.XMLHttpRequest) {
xhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET", "http://www.mon site.com/GeoJSON/MarignaneWGS84.geojson", true);
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
utiliserLaReponse(JSON.parse(xhttp.responseText));
}
}
xhttp.send();
var Marignane = L.geoJSON(xhttp).addTo(mymap); |
Partager