Select to view content in your preferred language

JS API: Cannot zoom to max level after changing basemap

3535
2
Jump to solution
04-21-2015 10:40 AM
MichaelSchnack
New Contributor II

I was wondering if anyone else has encountered this and has a workaround:

I have created a map with the javascript API which uses the basemapGallery widget.  The default map is dark-gray, which has a max zoom level of 16.  If the user changes the basemap to Imagery with Labels ("hybrid"), they still can only zoom to a max level of 16, and not to 19, which the hybrid map supports.

If I set the default map to hybrid, the max zoom level works as it should.

Setting the maxZoom when initiating the map does not make a difference.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Michael,

   If you are going to use a basemap that does not have all the LODs that other basemaps do as the default then you need to manually add the LODs to the maps constructor argument:

Map | API Reference | ArcGIS API for JavaScript

Look for the LOD section of the maps constructor option properties.

You can get the LODs json string from the basemap service like this:

http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=pjson

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Michael,

   If you are going to use a basemap that does not have all the LODs that other basemaps do as the default then you need to manually add the LODs to the maps constructor argument:

Map | API Reference | ArcGIS API for JavaScript

Look for the LOD section of the maps constructor option properties.

You can get the LODs json string from the basemap service like this:

http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=pjson

MichaelSchnack
New Contributor II

That did the trick Robert, thank you!

0 Kudos