How can I check whether Mapquest Map is fully loaded?

4 posts / 0 new
Last post
joshiakshay0005...
How can I check whether Mapquest Map is fully loaded?

I’m embedding mapquest Map into the website. Once mapquest Map is loaded, I want to start off a few JavaScript processes.

Is there a way to auto-detect when mapquest Map is fully loaded, including tiles download?

Is there an event which will be triggered when mapquest map is loaded/reloaded?


MQBrianCoakley
MapQuest.js is based on
MapQuest.js is based on Leaflet so you can use functions like the layer on load event.

joshiakshay0005...
How can I check whether Mapquest Map is fully loaded?

Thanks @MQBrianCoakley for the response.

I was looking for load event when the map is toggled between map/satellite view and all tiles are loaded. 

However the load event is triggered only on map tileLayer. Is there a common event which will be triggered when the tiles are loaded for satellite view as well ?

Code below works only for map view:

var baseLayer = L.mapquest.tileLayer('map');

        

 var map = L.mapquest.map('map', {

       center: [37.7749, -122.4194],

          layers: baseLayer,

          zoom: 12

 });

map.addControl(L.mapquest.control());

baseLayer.on("load",function() { 

          console.log("map - all visible tiles have been loaded");

        });

        

        baseLayer.on("map_type_changed",function() { 

          console.log('test');

        });


MQBrianCoakley
There is no event attached by
There is no event attached by default. The default MapQuest style controls do not have this function. But the default Leaflet control or custom controls can be built with the event handler on each layer.