Created
July 8, 2015 03:15
-
-
Save manukapoor/029db1530ff4f9e85e2e 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style> | |
#map{width: 100%;height: 500px} | |
.leaflet-layer:nth-child(2) { | |
opacity: 0.75; | |
} | |
</style> | |
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.2.1/mapbox.css' rel='stylesheet' /> | |
</head> | |
<body> | |
<div id ="map"></div> | |
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.2.1/mapbox.js'></script> | |
<script> | |
var geojson={ | |
"type": "FeatureCollection", | |
"features": [ | |
{ | |
"type": "Feature", | |
"properties": { | |
"title": "Sandys Billiard Parlour", | |
"address": "443 Seymour Street", | |
"description": "Red Agitators meeting spot", | |
"page": 123 | |
}, | |
"geometry": { | |
"type": "Point", | |
"coordinates": [ | |
-123.113932, | |
49.284416 | |
] | |
} | |
}, | |
{ | |
"type": "Feature", | |
"properties": { | |
"title": "The Palomar", | |
"address": "713 Burrard Street", | |
"description": "Legendary Nightclub", | |
"page": 27 | |
}, | |
"geometry": { | |
"type": "Point", | |
"coordinates": [ | |
-123.121296, | |
49.284308 | |
] | |
} | |
}, | |
{ | |
"type": "Feature", | |
"properties": { | |
"title": "Showa Club", | |
"address": "382 Powell Street", | |
"description": "The Black Dragon Society", | |
"page": 71 | |
}, | |
"geometry": { | |
"type": "Point", | |
"coordinates": [ | |
-123.095853, | |
49.283017 | |
] | |
} | |
}, | |
{ | |
"type": "Feature", | |
"properties": { | |
"title": "City Dump Hobo Jungle", | |
"address": "Prior Street", | |
"description": "home to over 450 vagrants", | |
"page": 111 | |
}, | |
"geometry": { | |
"type": "Point", | |
"coordinates": [ | |
-123.084506, | |
49.276442 | |
] | |
} | |
} | |
] | |
}; | |
L.mapbox.accessToken = 'pk.eyJ1IjoibWFudWthcG9vciIsImEiOiI5YzIwZWVkMGRjZDdmZDI5ODlkNTA0MjU4ZDg1MDdiYSJ9.SQmMHvZqGtFxuReylA3ELA'; | |
// 1937 tile set with attribution | |
var van_1937 = L.tileLayer( 'http://mapwarper.net/maps/tile/10066/{z}/{x}/{y}.png' ); | |
// 2015 tile set attribution | |
var attribution_2015 = 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, Imagery © <a href="http://mapbox.com">Mapbox</a>'; | |
// 2015 tile set using MapBox ID (replace with your own) | |
var van_2015 = L.tileLayer( 'https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png',{id: 'manukapoor.mlea4a6c',attribution: attribution_2015}); | |
// create the map with the default the tileset | |
var map = L.mapbox.map('map', 'mapbox.streets') | |
.setView([49.28273, -123.12074], 13).featureLayer.setGeoJSON(geojson);; | |
map.addLayer(van_1937); | |
map.addLayer(van_2015); | |
// var map = L.map('map', {layers:van_1937}); | |
// create a variable to hold all tile sets and name them so we can use it for the toggler | |
var baseMaps = {"Vancouver 2015": van_2015, "Vancouver 1937": van_1937 | |
}; | |
// add the tile set switcher control | |
L.control.layers(baseMaps).addTo(map); | |
// zoom and center in downtown Vancouver | |
map.setView([49.28273, -123.12074],13); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment