i'm trying to load a geojson file on a leaflet map. here is the code :
body :
<!DOCTYPE html>
<html>
<head>
<title>map</title>
<link href="leaflet.css" type="text/css" rel="stylesheet">
<link href="index.css" type="text/css" rel="stylesheet">
</head>
<body>
<div id="map"></div>
<script src="jquery-3.2.1.min.js"></script>
<script src="leaflet.js"></script>
<script src="index.js"></script>
<script src="loc_infra.js"></script>
</body>
</html>
javascript :
var map = L.map('map',{
center:[5,28],
zoom: 3,
minZoom: 2,
maxZoom: 18,
});
L.tileLayer('http://{s}.tiles.mapbox.com/v3/ianmule.bg2v5cdi/{z}/{x}/{y}.png',{attribution: "Mapbox"}).addTo(map);
function basement (feature,layer){
layer.bindPopup("SURPRISE")
}
var c2 = L.geoJson(loc_infra, {
style:
{
weight: 4,
color: "red",
opacity: 1,
fillColor: "red",
fillOpacity: 0.5
},
onEachFeature: basement
}).addTo(map);
and a little CSS :
html, body, #map {
height: 100%;
width:100%;
font-family: : sans-serif;
}
and the geojson i'm trying to launch :
var loc_infra =
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [........
but my layer is not visible on the map, and i can't understand why !