Created
September 17, 2018 01:40
-
-
Save andrewharvey/454edc6d83a81fdaa47f11a45e1ddf52 to your computer and use it in GitHub Desktop.
NSW 1934 vs now
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> | |
<head> | |
<meta charset='utf-8' /> | |
<title>NSW 1943 vs now</title> | |
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> | |
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.49.0/mapbox-gl.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.49.0/mapbox-gl.css' rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
</style> | |
</head> | |
<body> | |
<style> | |
body { | |
overflow: hidden; | |
} | |
body * { | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
} | |
.map { | |
position: absolute; | |
top: 0; | |
bottom: 0; | |
width: 100%; | |
} | |
</style> | |
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.js'></script> | |
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.css' type='text/css' /> | |
<div id='before' class='map'></div> | |
<div id='after' class='map'></div> | |
<script> | |
mapboxgl.accessToken = 'pk.eyJ1IjoiYWxhbnRnZW8tcHJlc2FsZXMiLCJhIjoiNkRKcXdVdyJ9.XVLiu2tRo5f2P__oBfdqsw'; | |
var center = [151.1196, -33.8490] | |
var zoom = 11; | |
var beforeMap = new mapboxgl.Map({ | |
container: 'before', | |
style: { | |
version: 8, | |
sources: { | |
tiles: { | |
type: 'raster', | |
tiles: ['http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/sydney1943/MapServer/tile/{z}/{y}/{x}'], | |
tileSize: 256 | |
}, | |
overlay: { | |
type: 'raster', | |
url: 'mapbox://openstreetmap.map-inh76ba2', | |
tileSize: 256 | |
} | |
}, | |
layers: [{ | |
id: 'tiles', | |
type: 'raster', | |
source: 'tiles', | |
minzoom: 0, | |
maxzoom: 19 | |
}, { | |
id: 'overlay', | |
type: 'raster', | |
source: 'overlay', | |
minzoom: 0, | |
maxzoom: 19 | |
}] | |
}, | |
center: center, | |
zoom: zoom | |
}); | |
var afterMap = new mapboxgl.Map({ | |
container: 'after', | |
style: { | |
version: 8, | |
sources: { | |
tiles: { | |
type: 'raster', | |
tiles: ['http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Imagery/MapServer/tile/{z}/{y}/{x}'], | |
tileSize: 256 | |
}, | |
overlay: { | |
type: 'raster', | |
url: 'mapbox://openstreetmap.map-inh76ba2', | |
tileSize: 256 | |
} | |
}, | |
layers: [{ | |
id: 'tiles', | |
type: 'raster', | |
source: 'tiles', | |
minzoom: 0, | |
maxzoom: 19 | |
}, { | |
id: 'overlay', | |
type: 'raster', | |
source: 'overlay', | |
minzoom: 0, | |
maxzoom: 19 | |
}] | |
}, | |
center: center, | |
zoom: zoom | |
}); | |
var map = new mapboxgl.Compare(beforeMap, afterMap, { | |
mousemove: true | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment