forked from zross's block: Simple Leaflet with CartoDB tiles
xxxxxxxxxx
<html>
<head>
<title>Leaflet GeoJSON Example</title>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="https://cdn.leafletjs.com/leaflet-0.7/leaflet.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7/leaflet.min.js"></script>
<style>
html, body, #map {
height:100%;
width:100%;
padding:0px;
margin:0px;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map('map').setView([38, -96], 5);
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
maxZoom: 5,
minZoom: 5
}).addTo(map);
var points = new L.geoJson();
points.addTo(map);
$.ajax({
dataType: "json",
url: "temp.geojson",
success: function(data) {
$(data.features).each(function(key, data) {
points.addData(data);
});
}
}).error(function() {});
</script>
</body>
</html>
Modified http://cdn.leafletjs.com/leaflet-0.7/leaflet.js to a secure url
https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js
https://cdn.leafletjs.com/leaflet-0.7/leaflet.js