How to get tile for click event in sheet marker cluster?

Here is my code.

function onMapClick(e) { e.originalEvent.defaultPrevented = true; var orig = e.originalEvent; console.log(orig.target); } map.on('click', onMapClick); 

console.log will display a fragment of ie

 <img class="leaflet-tile leaflet-tile-loaded" ... /> 

But I could not find the tile when I use the cluster of booklet markers. How to get a tile in a cluster of booklet markers with a click event on a map?

+4
javascript jquery leaflet
source share
1 answer

The best way to get tiles is to calculate it from the coordinates. There are many design implementations of the OpenStreetMap wiki .

Here you have a working example in JSFiddle . Just use it in the map.on method:

 map.on('click', function(e) { console.log(getTileURL(e.latlng.lat, e.latlng.lng, map.getZoom())); }); 
+2
source share

All Articles