Test getGeoJson
by Nicolas
HTML
<script src="http://cdn.jsdelivr.net/leaflet/0.7.3/leaflet.js"></script>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/leaflet/0.7.3/leaflet.css">
<script src="http://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js"></script>
<script src="http://vegactu.com/m1/europe_abattoir/data/abattage_europe2.json"></script>
<script src="http://bl.ocks.org/awoodruff/raw/728754e48c11a94b522b/neighborhoods.geojson"></script>
<script src="http://maptimeboston.github.io/leaflet-intro/rodents.geojson"></script>
<div id="map"></div>
CSS
#map {
width: 800px;
height: 500px;
}
JavaScript
// initialize the map
var map = L.map('map').setView([42.35, -71.08], 13);
// load a tile layer
L.tileLayer('http://tiles.mapc.org/basemap/{z}/{x}/{y}.png',
{
attribution: 'Tiles by <a href="http://mapc.org">MAPC</a>, Data by <a href="http://mass.gov/mgis">MassGIS</a>',
maxZoom: 17,
minZoom: 9
}).addTo(map);
$.getJSON("http://maptimeboston.github.io/leaflet-intro/neighborhoods.geojson",function(hoodData){
L.geoJson( hoodData ).addTo(map);
});
$.getJSON("http://maptimeboston.github.io/leaflet-intro/rodents.geojson",function(data){
var ratIcon = L.icon({
iconUrl: 'http://andywoodruff.com/maptime-leaflet/rat.png',
iconSize: [60,50]
});
L.geoJson(data,{
pointToLayer: function(feature,latlng){
var marker = L.marker(latlng,{icon: ratIcon});
marker.bindPopup(feature.properties.Location + '<br/>' + feature.properties.OPEN_DT);
return marker;
}
}).addTo(map);
});