Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<script>
var map = new L.map('map').setView([50.7344700,7.0987190], 15);
var OpenStreetMap_Mapnik = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> Mitwirkende',
}).addTo(map);
var api = new L.OverPassLayer({
endpoint: "http://overpass.osm.rambler.ru/cgi/",
query: "node(BBOX)[amenity=post_box];out;",
callback: function(data) {
for(var i=0;i<data.elements.length;i++) {
var e = data.elements[i];
if (e.id in this.instance._ids) return;
this.instance._ids[e.id] = true;
var pos = new L.LatLng(e.lat, e.lon);
var popup = this.instance._poiInfo(e.tags,e.id);
var color = e.tags.collection_times ? 'green':'red';
var circle = L.circle(pos, 50, {
color: color,
fillOpacity: 0
})
.bindPopup(popup);
this.instance.addLayer(circle);
}
},
});
map.addLayer(api);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment