Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created April 8, 2014 22:36
Show Gist options
  • Select an option

  • Save tmcw/10203442 to your computer and use it in GitHub Desktop.

Select an option

Save tmcw/10203442 to your computer and use it in GitHub Desktop.
var map = L.mapbox.map('map', 'XXX', {zoomControl: false})
.setView([-20.1908, -67.5893], 3);
var geoJson = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [-67.5893, -20.1908]
},
properties: {
title: 'Salar de Uyuni',
'marker-size': 'small',
'marker-color': '#fff',
url: 'http://localhost'
}
},
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [170.2, -43.4764]
},
properties: {
title: 'Franz Josef Glacier',
'marker-size': 'small',
'marker-color': '#fff',
url: 'http://localhost'
}
}
]
};
var myLayer = L.mapbox.featureLayer()
.setGeoJSON(geoJson)
.addTo(map);
myLayer.on('click', function(e) {
e.layer.unbindPopup();
window.open(e.layer.feature.properties.url);
});
map.fitBounds(myLayer.getBounds());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment