Cannot read property 'mapDiv_layer0_tile_4_0_0' of null when using basemap gallery

760
3
Jump to solution
08-11-2014 06:38 PM
DavidElies
New Contributor III

When I use the basemap gallery to select an arcgis basemap upon map load, I get 30-40 errors like Cannot read property 'mapDiv_layer0_tile_4_2_7' of null.This seems to be because of a 0-length timeout that is requested when the original basemap is added, whose callback tries to access the tiles for that basemap which has already been replaced, (there's a new layer in its place).  This doesn't happen if I choose a non-arcgis basemap like a Bing basemap.

Can anyone tell me what is causing this and offer a solution to fix it?

I have already tried not loading an initial basemap and using the basemap gallery to load the first basemap, but this does not work (no basemap is loaded, but no errors).

If someone knows how to check if the requested basemap is an esri basemap without hard-coding the name or id or anything else, I would like to know that too, since i could load esri maps another way (on map initialization or by manually adding a layer).

Thanks for your help!

0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor

Do you have a sample app that shows the problem? I ran a quick test using two samples in the help and cannot reproduce.

Toggle multiple ArcGIS Online services | ArcGIS API for JavaScript

Basemap gallery | ArcGIS API for JavaScript

View solution in original post

0 Kudos
3 Replies
DavidElies
New Contributor III

One update...I cleared the cache and now I get the 30-40 errors no matter what basemap I select. Anybody who'd like to share any insights?

0 Kudos
KellyHutchins
Esri Frequent Contributor

Do you have a sample app that shows the problem? I ran a quick test using two samples in the help and cannot reproduce.

Toggle multiple ArcGIS Online services | ArcGIS API for JavaScript

Basemap gallery | ArcGIS API for JavaScript

0 Kudos
DavidElies
New Contributor III

Hi Kelly,

I tried the examples you suggested.  They don't have the problem.  I don't have access to a public server to share code examples, but I noticed that the examples use the new API version 3.10.  I switched my application to use 3.10 (I was using 3.9) and the problem isn't occuring right now.  I note that in the "What's New" page for 3.10, the undefined "" error was fixed, maybe some of these async errors were also fixed, or maybe I'm just a dummy.  In any event, thanks for the push in the right direction.  I'll monitor the issue and see if it continues.

0 Kudos