Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created February 19, 2013 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/4991195 to your computer and use it in GitHub Desktop.
Save tmcw/4991195 to your computer and use it in GitHub Desktop.
<!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>
<style>
.marker-image {
width:100px;
height:100px;
border:1px solid #000;
margin-left:-51px;
margin-top:-51px;
pointer-events:all;
position:absolute;
}
</style>
<div id='map'></div>
<script>
// Create map
var map = mapbox.map('map');
map.addLayer(mapbox.layer().id('examples.map-vyofok3q'));
// Create and add marker layer
var markerLayer = mapbox.markers.layer().features([{
"geometry": { "type": "Point", "coordinates": [-74.00, 40]},
"properties": { "id": "foo" }
}, {
"geometry": { "type": "Point", "coordinates": [-75.00, 40]},
"properties": { "id": "bar" }
}]).factory(function(f) {
var elem = mapbox.markers.simplestyle_factory(f);
elem.id = f.properties.id;
return elem;
});
map.addLayer(markerLayer)
.setExtent(markerLayer.extent());
// Attribute map
map.ui.attribution.add()
.content('<a href="http://mapbox.com/about/maps">Terms &amp; Feedback</a>');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment