Last active
April 18, 2018 04:40
-
-
Save awoodruff/1dc36a658a2e24e01b12 to your computer and use it in GitHub Desktop.
Leaflet: basic #ratmap
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
<html> | |
<head> | |
<title>A Leaflet map!</title> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/> | |
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> | |
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<style> | |
#map{ height: 100% } | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script> | |
// 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); | |
// load GeoJSON from an external file | |
$.getJSON("rodents.geojson",function(data){ | |
// add GeoJSON layer to the map once the file is loaded | |
L.geoJson(data).addTo(map); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment