Select to view content in your preferred language

zoom to graphics on featureLayer

653
3
12-12-2012 01:02 PM
Kevin_FernandoEscalera_Robles
New Contributor III
Hi, I'm working on a tool that makes a query to a layer an then I zoom to the results with the Map.zoomTo() method sending the envelope of the geometry(s) as a parameter, the problem is that since the Layer is scale dependant sometimes the zoomTo takes me to a extent where the featureLayer is not visible. I would like to find a way to determine if the FeatureLayer will be visible when I zoom the map to that extent and if not zoom until the featureLayer is visible.

I'm using a tiled map service as a base map by the way.

Does anybody have some Ideas on how to acomplish this?
0 Kudos
3 Replies
SanajyJadhav
Occasional Contributor II
In my experience, feature layer's Visible property always returns true, regardless of the current state of the layer.

In my opinion, you might want to use MaximumResolution and MinimumResolution properties on the feature layer class. Based on current map scale/resolution, you should be able to determine the state of the feature layer.

HTH.
0 Kudos
Kevin_FernandoEscalera_Robles
New Contributor III
I tryed that, but those fields are from 0 to inifinit, as there where no scale dependency set, as a workaround I have set the featurelayer to omit scale dependency, but thats not what I want
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I tryed that, but those fields are from 0 to inifinit, as there where no scale dependency set, as a workaround I have set the featurelayer to omit scale dependency, but thats not what I want

If IgnoreServoceScaleRange is false, the layer honors both scale ranges, the scale range defined at client side (by Layer.MinimumResolution and Layer.MaximumResolution) and the scale range defined at server side.
The latter scale range is defined by the MinimumScale and MaximumScale of FeatureLayer.LayerInfo.
I guess in your case you have to use these values.
0 Kudos