Change basemap not loading

999
3
02-08-2021 03:25 PM
smaawais
New Contributor

Hi,

In our iOS app, we load basemaps using portal.fetchbasemap, then we provide user options to select the basemap and we change the basemap

esriMapView.map?.basemap = selectedBasemap

For some basemaps, when we change the basemap it does not take affect, and show grey grid lines.

On our web portal, I have noticed that these basemap that does not change are shown disabled.

What could be a reason that some basemap does work and other works? Is there a way to check which basemaps will not work with the given map, so that user is not shown that option.

Tags (1)
0 Kudos
3 Replies
DiveshGoyal
Esri Regular Contributor

Those basemaps may not be compatible with your map's spatial reference. 
To know for sure, check the layer's spatial reference property, and compare it with the map's.
You can also inspect the Layer's view state to see if there is an error or more information
Check out this sample - https://developers.arcgis.com/ios/swift/sample-code/display-layer-view-state/

smaawais
New Contributor

Thanks Divesh,

But this approach will only work when we try applying the basemap, but we want to filter out those basemap that wont work before showing that option to user. Is there a way to do that.

0 Kudos
smaawais
New Contributor

Hi, 

Found a solution to this, I read somewhere to get the basemap's spatial reference we can check the basemap's baselayer's spatial reference. So had to load the baselayer to get to the spatial reference and compare with map's spatial reference.

Out of curiosity, when we do basemap.item.fetchDataWithCompletion it returns raw data. How can we use that or which object we can create from it? 

One more question the name of the basemap on mobile are slightly different from what we have on our portal, e.g. mobile shows '_' for some names where as portal does not, and also protal shows a longer name. Any idea why this is different.

 

 

0 Kudos