var map = L.map('map').setView([39.9897471840457, -75.13893127441406], 11)
// Add basemap
L.tileLayer('http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© OpenStreetMap'
}).addTo(map)
// Add GeoJSON
$.getJSON('./crimes_by_district.geojson', function (geojson) {
L.choropleth(geojson, {
valueProperty: 'incidents',
scale: ['white', 'red'],
steps: 5,
mode: 'q',
style: {
color: '#fff',
weight: 2,
fillOpacity: 0.8
},
onEachFeature: function (feature, layer) {
layer.bindPopup('District ' + feature.properties.dist_num + '
' +
feature.properties.incidents.toLocaleString() + ' incidents')
}
}).addTo(map)
})