Getting the max and min resolutions from a ArcGISTiledMapServiceLayer

1964
3
08-10-2012 08:05 AM
NicoTek
New Contributor III
My question is how does the MapView know what is the max and min resolution of the first layer I add to it, yet I have no way of finding out?

for example:

ArcGISTiledMapServiceLayer basemap = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");

I have no way of knowing the max and min resolution
but then if I do,

map = (MapView) findViewById(R.id.map);
map.addLayer(basemap, 0);

I can get

map.getMaxResolution();
map.getMinResolution();

My problem is that, if now I want to change the basemap for one with a different max and min resolutions I have no dynamic way of knowing what they are, and it is important to know what they are in order to be able to restrict the zoom.

Any Ideas?
0 Kudos
3 Replies
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
I believe the MapView gets the min/max resolutions from the layers when they are initialized.  They are initialized when you call .AddLayer().  What you could do is add each layer to the map, but make only one visible. Since they are all added/initalized, you can call the min/max resolutions as you need.
0 Kudos
NicoTek
New Contributor III
@AMandrewb

Thanks for your suggestion but that solution does not really work because the mapview only gets the max a min resolution from the first layer that you add.

At the moment what I did was to add each layer once as the first layer and log.d the max and min of the mapview for that session and write that down and save the information somewhere, but what I would really like to know is how the mapview gets this information since there are no visible functions to get it.
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
Check out the Layer Class in the API Reference.  You could define your tiledmapservice as a TiledLayer  of the mapView and get it's current extent. 
http://help.arcgis.com/en/arcgismobile/10.0/apis/android/api/com/esri/android/map/Layer.html
0 Kudos