Select to view content in your preferred language

Basic FeatureLayer question

1023
5
03-21-2011 02:31 PM
KennMurphy
Emerging Contributor
I am trying to use a FeatureLayer to search for meters in our service territory. The searching works great, but I can't seem to get it to change the view so that all the returned features are in view. I was attempting to do it as follows, but it isn't working. The meters are in a layer that is visible only at a certain zoom level and I made sure to be zoomed in to the appropriate level before conducting the search.

private function updateEndFunction(event:Event):void
{
    var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(fLayer.selectedFeatures);
    OutageMap.extent = graphicsExtent;
}
Tags (2)
0 Kudos
5 Replies
DasaPaddock
Esri Regular Contributor
Is it going to the right area, but just too far zoomed in?
0 Kudos
KennMurphy
Emerging Contributor
It doesn't move at all. I can search for different meters and the marks will change, but the view never changes.
0 Kudos
DasaPaddock
Esri Regular Contributor
When is your updateEndFunction() being called? Are you calling selectFeatures() on your FeatureLayer?
0 Kudos
KennMurphy
Emerging Contributor
I set it in the FeatureLayer definition so I'm thinking it gets called after the Features get marked.

(i.e.):
<esri:FeatureLayer id="fLayer" visible="true" mode="snapshot" symbol="{MeterMark}" outFields="MeterNumber" updateEnd="zoomToExtent(event)" url="http://vmvea-arcgis:8399/arcgis/rest/services/Dispatch_Map/MapServer/0"/>


I wasn't calling selectFeatures, but I have changed my code to call the selectFeatures function to select all the features present in the layer, but the extent still doesn't change. Do i need to refresh the map or something to get it to move the view?
0 Kudos
KennMurphy
Emerging Contributor
I've decided to change tactics. I'm using a QueryTask with a GraphicsLayer instead of a FeatureLayer. I took the source code from the Zoom to query result example and it works great for selecting meters. It doesn't change the extent when there is only one meter selected, but since this is going to be an outage map I don't think it's an issue (at least not yet).

Thanks for all the help! 🙂
0 Kudos