Skip to content

Instantly share code, notes, and snippets.

@tristen
Last active October 4, 2015 11:17
Show Gist options
  • Save tristen/2627384 to your computer and use it in GitHub Desktop.
Save tristen/2627384 to your computer and use it in GitHub Desktop.
Chaining
var initMap = function() {
var provider = new MM.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
var map = new MM.Map('map', provider).setCenter(new MM.Location(43.6478,280.6421)).setZoom(5);
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Modest Maps JS Demo | Chaining</title>
<link rel='stylesheet' href='style.css'>
</head>
<body onload='initMap()'>
<div id='map' />
<script src='https://rawgithub.com/stamen/modestmaps-js/master/modestmaps.min.js'></script>
<script src='app.js'></script>
</body>
</html>
body {
font: 13px/22px 'Helvetica Neue', Helvetica, sans;
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0; left: 0;
width: 100%;
height: 100%;
}
@kevinvanleer
Copy link

This example seems to be out of date. I had to change:

var map = new MM.Map('map', provider).setCenter(new MM.Location(43.6478,280.6421)).setZoom(5);

to

var map = new MM.Map('map', provider).setCenterZoom(new MM.Location(43.6478,280.6421), 5);

before it centered the map in the right location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment