Select to view content in your preferred language

Need to catch Basemap load error event

504
1
06-14-2018 02:23 AM
SriHarsha
New Contributor III

Dear Sir,

               The base map which i am using in my application is currently being blocked from the source site.Due to this my application is getting crashed.Now,in this case I want to load another basemap(ex:"topo") on the fly if the initial basemap loading fails.Ideally it should be done in the failure event of the initial basemap loading.But I am not able to find any such event.Could anyone guide me in this regard.

Envirnoment details: 

ArcGIS Api for javascript 3.17 version

Initial basemap url: "web_mercator/gebco_2014_hillshade (MapServer) "

Alternate basemap url: "World_Topo_Map (MapServer) "

Below I am furnishing my code chunk.

var lyrGEBCO = new BasemapLayer({ url : "https://maps.ngdc.noaa.gov/arcgis/rest/services/web_mercator/gebco_2014_hillshade/MapServer" });

var bmapGEBCO = new Basemap ({ layers : [ lyrGEBCO ],
title : "GEBCO",
thumbnailUrl : "images/mgs_gebco.png"
});

var map = new Map ("iddivMap", {basemap : bmapGEBCO,
center : [ 82, 22 ],
zoom : 5,
slider : false,
logo : false
});

Regards,

Kishore Kumar

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Kishore,

   So what happens when it is blocked what is the error? Have you tried checking the lyrGEBCO to see if it is null or have some property that is null when it does not load or the bmapGEBCO object?

0 Kudos