Created
December 10, 2012 14:44
-
-
Save yhahn/4250932 to your computer and use it in GitHub Desktop.
Setting center and adding controls after mapbox.layer().id()
This file contains hidden or 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.6/mapbox.js'></script> | |
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.6/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 map = mapbox.map('map'); | |
map.addLayer(mapbox.layer().id('ollyb.map-yeqf7rmm', function(layer) { | |
var center = layer.tilejson().center; | |
map.centerzoom({lon:center[0], lat:center[1]}, center[2]); | |
map.ui.zoomer.add(); | |
})); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment