Created
December 21, 2012 19:29
-
-
Save wboykinm/4355174 to your computer and use it in GitHub Desktop.
compositing different-origin layers in mapbox.js
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> | |
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script> | |
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
</style> | |
</head> | |
<body> | |
<div id='map'> | |
</div> | |
<script> | |
var m = mapbox.map('map'); | |
//Define CartoDB tilejson | |
var communes = mapbox.layer().tilejson({ | |
version: '1.0.0', | |
scheme: 'xyz', | |
tiles: ['http://dai.cartodb.com/tiles/ag_2011_commune3/{z}/{x}/{y}.png'], | |
grids: ['http://dai.cartodb.com/tiles/ag_2011_commune3/{z}/{x}/{y}.grid.json'] | |
}); | |
//Add layers to map | |
m.addLayer(new mapbox.layer().id('landplanner.map-pd5ea4xu')); | |
m.addLayer(communes); | |
m.addLayer(new mapbox.layer().id('landplanner.map-lronacbg')); | |
m.ui.attribution.add() | |
.content('Data by <a href="http://openstreetmap.org">OpenStreetMap</a> Contributors, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'); | |
m.ui.zoomer.add(); | |
m.ui.zoombox.add(); | |
m.ui.hash.add(); | |
m.zoom(9).center({lat: 34.797408767572485, lon: -2.38330078125}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment