Last active
August 23, 2016 18:06
-
-
Save coppeliaMLA/568f252a070a4ee6b1ed81e3eea6a9db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.1/d3.min.js"></script> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css"/> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.min.js"></script> | |
<style> #mapid { | |
height: 800px; | |
} </style> | |
</head> | |
<body> | |
<div id="mapid"></div> | |
<script> | |
d3.json("point_data.json", function(json) { | |
var mymap = L.map('mapid').setView([51.505, -0.09], 13); | |
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { | |
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>', | |
maxZoom: 18, | |
id: 'mapbox.streets-basic', | |
accessToken: 'pk.eyJ1Ijoic2ltb25yYXBlciIsImEiOiJjaXBncHFob2UwMDBvdnJudHZqajA5bmJxIn0.LfOyy3BUvPeFTNPqyz9iNQ' | |
}).addTo(mymap); | |
L.geoJson(json, { | |
pointToLayer: function (feature, latlng) { | |
return L.circleMarker(latlng, { | |
radius: +feature.properties.value / 10, | |
color: 'red', | |
fillColor: '#f03', | |
fillOpacity: 0.5 | |
}); | |
} | |
}).addTo(mymap); | |
} | |
) | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment