Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created August 15, 2012 20:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/3363480 to your computer and use it in GitHub Desktop.
Save tmcw/3363480 to your computer and use it in GitHub Desktop.
markers csv with other file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Example</title>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.3/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.3/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map {
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
}
</style>
</head>
<body>
<div id='map'></div>
<script>
var m = mapbox.map('map');
m.addLayer(mapbox.layer().id('examples.map-4l7djmvo'));
// Create a markers layer with features from a CSV string.
reqwest({
url: 'markers.csv',
type: 'text',
success: function(resp) {
var markerLayer = mapbox.markers.layer().csv(resp.responseText);
// Add interaction to this marker layer. This
// binds tooltips to each marker that has title
// and description defined.
mapbox.markers.interaction(markerLayer);
m.addLayer(markerLayer);
}
});
m.zoom(6).center({ lat: 41.673, lon: 12.656 });
</script>
</body>
</html>
lat lon title marker-color
40.5 14 Naples #180392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment