Hello! Why can not the markers on the corners of the tiles be completely loaded?

enter image description here

map = L.mapbox.map('map', null); var layers = { Streets: L.mapbox.tileLayer('mapbox.streets'), }; layers.Streets.addTo(map); layers.Streets.on('tileload', function (e) { var topLeft = map.layerPointToLatLng([e.tile._leaflet_pos.y, e.tile._leaflet_pos.x]); L.marker([topLeft.lat, topLeft.lng]).addTo(map); } 
  • By the way, you at [e.tile._leaflet_pos.y, e.tile._leaflet_pos.x] confused x and y - tutankhamun
  • Actually, most likely this is the problem. The question can be deleted. - tutankhamun

1 answer 1

Part of the tiles the browser can load from the cache. In this case, the load event is not raised.

You can fix this by installing the tileloadstart handler and checking the complete property. If true call your handler, if not, wait until the load event fires.

See also:

  1. Cached images and the “load” event (in English)
  • Yet really, the coordinates were confused. Once again, thank you so much! =) - RSalnikov