Select to view content in your preferred language

feature layer zoom in

1374
9
09-15-2010 10:35 AM
abukhan
Occasional Contributor
how to zoom in the results from the feature layer query?
Tags (2)
0 Kudos
9 Replies
ReneRubalcava
Esri Frequent Contributor
A FeatureLayer is a subclass of a GraphcisLayer, so you can use GraphicUtil.getGraphicsExtent to do it, after you have done a selection on the FeatureLayer.

var ac:ArrayCollection = featureLayer.graphicProvider as ArrayCollection;
map.extent = GraphicUtil.getGraphicsExtent(ac.toArray());
0 Kudos
abukhan
Occasional Contributor
Which event in feature layer that fires at the end of query results? I mean in which event (in feature layer) fires when all the features are returned to the client from the server?
0 Kudos
ReneRubalcava
Esri Frequent Contributor
Looking at the docs
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html

The returned event is QUERY_FEATURES_COMPLETE.
com.esri.ags.events.FeatureLayerEvent.QUERY_FEATURES_COMPLETE
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html#event:queryFeatur...

I have not used queryFeatures in my apps yet, so I'm not sure if results will be displayed as graphics on screen, but the QUERY_FEATURES_COMPLETE event returns a FeatureSet.
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/events/FeatureLayerEvent.html
0 Kudos
DasaPaddock
Esri Regular Contributor
QUERY_FEATURES_COMPLETE is for when you call the queryFeatures() method:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html#queryFeatures()

Listen for updateEnd if you want to know when the FeatureLayer has finished loading new features and made them available in it's graphicProvider.
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/Layer.html#event:updateEnd
0 Kudos
abukhan
Occasional Contributor
One issue with updateEnd that it even happens when panning or zooming (the feature layer gets updates with zooming and panning).

Is there any event that I can use when feature layer first time gets queried using definitionexpression.
( i would like to zoomin to the return features at the initial time)...

So what is happening now If I put my code(for zooming in the return features) in the updateEnd event, any time user pans , it comes to the previous zooming....
0 Kudos
abukhan
Occasional Contributor
One way I solved this issue using an boolean variable that I set initially and the updateend checks for this boolean variable (only does zooming in the first time)..
0 Kudos
abukhan
Occasional Contributor
About the utility function :

GraphicUtil.getGeometries

It extracts array of geometries from array of graphics

Is there any way to get features that are outside and touching these geometries?
I mean if there are 20 geometries (of graphics), I want to get features that are outside the 20 geometries touching them...
0 Kudos
DasaPaddock
Esri Regular Contributor
One way I solved this issue using an boolean variable that I set initially and the updateend checks for this boolean variable (only does zooming in the first time)..


Another option may be to remove the updateEnd listener.
0 Kudos
DasaPaddock
Esri Regular Contributor
About the utility function :

GraphicUtil.getGeometries

It extracts array of geometries from array of graphics

Is there any way to get features that are outside and touching these geometries?
I mean if there are 20 geometries (of graphics), I want to get features that are outside the 20 geometries touching them...


You may be able to do this using a geoprocessing task:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/tasks/Geoprocessor.html
0 Kudos