Quantcast
Channel: Forums - ArcGIS Viewer for Flex
Viewing all articles
Browse latest Browse all 2097

Loop through featureSet and get xy of features

$
0
0
I need to loop through a feature set that I always get one result in, if there is more I can take just the first or last one. I want to zoom to that selected point. I have not found a good example on how to do this. I can hard code xy values and get it to work, but I want the xy of the record that is returned in my record set. Any help would be appreaciated.


private function doQuery():void
{
// clear the graphics layer
myGraphicsLayer.clear();

queryTask.execute(query, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void
{
Alert.show("In Function" + featureSet.features.length);
if (featureSet.features.length == 0)
{
Alert.show("No Feature found. Please try again.");
}
else
{
Alert.show("Record Found");
const mapPoint:MapPoint = new MapPoint();
//dynamically get xy here
mapPoint.x=-7033340.3;
mapPoint.y=5827584.9;
map.scale=15000;
map.centerAt(mapPoint);
}
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString());
}
}

Viewing all articles
Browse latest Browse all 2097

Trending Articles