I'm trying to use a geojson hosted on GitHub (rif. https://raw.githubusercontent.com/cesaregerbino/DatiGeo/master/ScuoleTorino.geojson), from Leaflet.
here you are my code ....
My first Leaflet map
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://localhost/Leaflet/072/leaflet.css" />
<script src="http://localhost/Leaflet/072/leaflet.js"></script>
<script src="https://raw.github.com/calvinmetcalf/leaflet-ajax/master/dist/leaflet.ajax.min.js"></script>
<script>
var map = L.map('map').setView([42, 12], 6);
L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright" title="OpenStreetMap" target="_blank">OpenStreetMap</a> contributors | Tiles Courtesy of <a href="http://www.mapquest.com/" title="MapQuest" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png" width="16" height="16">',
subdomains: ['otile1','otile2','otile3','otile4']
}).addTo(map);
var popup = L.popup();
function onMapClick(e) {
popup
.setLatLng(e.latlng)
.setContent("Le coordinate del punto che hai cliccato sono " + e.latlng.toString())
.openOn(map);
}
map.on('click', onMapClick);
function popUp2(feature, layer) {
layer.bindPopup(feature.properties.name);
}
var geojsonLayer = new L.GeoJSON.AJAX("https://raw.githubusercontent.com/cesaregerbino/DatiGeo/master/ScuoleTorino.geojson", {onEachFeature:popUp2});
<!-- var geojsonLayer = new L.GeoJSON.AJAX("http://localhost/ProveLeaflet/ScuoleTorino.geojson", {onEachFeature:popUp2}); -->
geojsonLayer.addTo(map);
</script>
The page doesn't show the markers of my geojson file: it seems that no return come from the request. Here you are the situation
If I put the same geojson file under my apache it works fine.
The new situation ...
I've tried to use the same geojson form QGIS desktopanche it works too.
The image ....
Any suggestions?