<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="Query, then zoom to results" styleName="plain" initialize="init()"> <mx:Script> <![CDATA[ import com.esri.ags.Graphic; import com.esri.ags.geometry.Polygon; import com.esri.ags.FeatureSet; import mx.controls.Alert; import mx.rpc.AsyncResponder; import mx.collections.ArrayCollection; [Bindable] public var myAC:ArrayCollection = new ArrayCollection(); [Bindable] public var myQueryString:String = "%"; private function init():void { queryTask.execute(initquery, new AsyncResponder(onResult, onFault)); function onResult(featureSet:FeatureSet, token:Object = null):void { for each (var myGraphic1:Graphic in featureSet.features) { myAC.addItem(myGraphic1.attributes.PROJECTID); } } function onFault(info:Object, token:Object = null):void { Alert.show(info.toString()); } } ]]> </mx:Script> <!-- Start Declarations --> <!-- Symbol for Query Result as Polygon --> <esri:SimpleFillSymbol id="sfs" alpha="0.7" color="0xFF0000"/> <!-- Layer with US States --> <esri:QueryTask id="queryTask" url="http://......"/> <esri:Query id="initquery" text="{myQueryString}" returnGeometry="false" outSpatialReference="{map.spatialReference}"> <esri:outFields> <mx:String>*</mx:String> </esri:outFields> </esri:Query> <mx:HBox width="100%" height="40" backgroundColor="0xDDDDFF" paddingTop="10" horizontalAlign="center"> <mx:Label text="Project ID"/> <mx:ComboBox id="QueryComboBox" dataProvider="{myAC}"> </mx:ComboBox> </mx:HBox> <mx:VDividedBox height="100%" width="100%"> <esri:Map id="map"> <esri:extent> <esri:Extent xmin="-126" ymin="24" xmax="-67" ymax="50"> <esri:SpatialReference wkid="4326"/> </esri:Extent> </esri:extent> <esri:ArcGISDynamicMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/> <esri:GraphicsLayer id="myGraphicsLayer" symbol="{sfs}"/> </esri:Map> </mx:VDividedBox> </mx:Application>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.