Skip to content

Instantly share code, notes, and snippets.

@rfriberg
Last active February 28, 2017 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfriberg/9b85b62bf26f4a562bf09879b4a4354b to your computer and use it in GitHub Desktop.
Save rfriberg/9b85b62bf26f4a562bf09879b4a4354b to your computer and use it in GitHub Desktop.
San Juan Island - Leaflet
<!DOCTYPE html>
<html lang="en">
<head>
<title>San Juan Island - Leaflet</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://mapzen.com/js/mapzen.css">
<script src="https://mapzen.com/js/mapzen.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-ajax/2.1.0/leaflet.ajax.js"></script>
<style>
#map {
height: 100%;
width: 100%;
position: absolute;
}
html,body{margin: 0; padding: 0}
</style>
</head>
<body>
<div id="map"></div>
<script>
// Mapzen API key (replace key with your own)
// To generate your own key, go to https://mapzen.com/developers/
L.Mapzen.apiKey = 'mapzen-JA21Wes';
var english_camp = [48.5865, -123.1433];
var map = L.Mapzen.map('map', {
center: english_camp,
zoom: 15,
scene: L.Mapzen.BasemapStyles.Refill
});
var san_juan_nhp = new L.GeoJSON.AJAX('https://gist.githubusercontent.com/rfriberg/684645c22f495b4a46f29fb312b6d268/raw/843ed38a3920ed199082636fe198ba995f5cfc04/san_juan_nhp.geojson', {
style: {
color: '#518946',
weight: 2,
opacity: 1,
fillColor: '#BCE3B4',
fillOpacity: 0.8
}
});
san_juan_nhp.addTo(map);
// Move zoom control to the top right corner of the map
map.zoomControl.setPosition('topright');
// Mapzen Search box (replace key with your own)
// To generate your own key, go to https://mapzen.com/developers/
var geocoder = L.Mapzen.geocoder('mapzen-JA21Wes');
geocoder.addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment