Select to view content in your preferred language

How to retrieve Min and Max Scale of Feature Layer?

776
3
01-26-2011 11:15 PM
roufbaba
Deactivated User
Hi,

How can I retrieve min and max scales for a Feature Layer which has been set in the MXD? As far sa LayerInfo is concerned, it includes Min and Max Resolution but those values doesn't match with the values defined in the MXD. It always returns 0 and Infinity respectively.


Thanks and Best Regards
Rouf
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
This information is provided by the map service rest end point from ArcGIS server version 10SP1.
So to get it, you need ArcGIS server 10SP1 and ArcGIS SL 2.1.

Which server version have you?

You can check if the resolution is provided by requesting your map service rest end point.

Example of service with the info:
http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Age/MapServer?f=pjson

Example of service without the info:
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=...
0 Kudos
roufbaba
Deactivated User
Hi,

Thanks for your quick reply. As suggested by you I switched to SL 2.1 and AGS 10 sp1. The issue still remains there, what I can find is Feature Layer Min and Max Resolution is still 0 and infinity. But, one thing I tried is that I consumed the service as ArcGISDynamicMapServiceLayer and I was able to get the Min and Max scale. The issue is I don't want to add the service as Dynamic. I just want to consume the Feature Server Layers.

Any suggestion!!

Thanks
Rouf
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Unfortunately the scale information is not available when you consume a feature server layer.

The workarounds could be:
- To query and deserialize the json response by yourself
or
- to create a temporarly ArcGISDynamicMapServiceLayer useful only to retrieve this info.
In this case, you don't need to add it to your map, you can instantiate it and call Initialize:

  var arcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer
                          {
                    Url = myMapServiceUrl
                           };
  arcGISDynamicMapServiceLayer.Initialized += Layer_Initialized;
  arcGISDynamicMapServiceLayer.Initialize();
}
 
void Layer_Initialized(object sender, System.EventArgs e)
{
    var layer = sender as ArcGISDynamicMapServiceLayer;
    // Maxscale and Minscale are available here in layer.Layers[index] 
}
0 Kudos