Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bartek
Created August 9, 2013 14:48
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 bartek/cccfe38a8c33ebec4c02 to your computer and use it in GitHub Desktop.
Save bartek/cccfe38a8c33ebec4c02 to your computer and use it in GitHub Desktop.
// Simple helper function for setting up a leaflet map.
var Leaflet = {
defaults: {
zoom: 13,
attributionControl: false
},
map: function(mapId, options) {
options = (options || {});
options = _.defaults(options, this.defaults);
var map = L.map(mapId).setView([
options.lat, options.lon], options.zoom);
L.tileLayer('http://{s}.tile.cloudmade.com/' + app.leaflet.apiKey + '/997/256/{z}/{x}/{y}.png', {
maxZoom: 18
}).addTo(map);
var marker = L.marker(
[options.lat, options.lon],
{icon: new L.Icon.Default()}
).addTo(map);
return map;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment