Flex4 ArcGis地图服务操作
发布时间:2020-12-15 03:42:27 所属栏目:百科 来源:网络整理
导读:1.简单使用 ?xml version="1.0" encoding="utf-8"?s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="Example #1" esri:Map esri:ArcGISTiledMap
1.简单使用
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="Example #1"> <esri:Map> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" /> </esri:Map> </s:Application> 2.定位地图位置 <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="A tiled map service" > <esri:Map> <esri:extent> <esri:Extent xmin="-1788000" ymin="-4177000" xmax="10044000" ymax="4511000"> <esri:SpatialReference wkid="102100"/> </esri:Extent> </esri:extent> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> </esri:Map> </s:Application> 3.查询 <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:esri="http://www.esri.com/2008/ags" xmlns:s="library://ns.adobe.com/flex/spark" pageTitle="Query Task (with a map)"> <s:layout> <s:VerticalLayout gap="10" horizontalAlign="center" paddingBottom="20" paddingLeft="25" paddingRight="25" paddingTop="20"/> </s:layout> <fx:Script> <![CDATA[ import com.esri.ags.Graphic; import com.esri.ags.FeatureSet; import mx.controls.Alert; import mx.rpc.AsyncResponder; private function doQuery():void { queryTask.execute(query,new AsyncResponder(onResult,onFault)); function onResult(featureSet:FeatureSet,token:Object = null):void { // No code needed in this simple sample,since the // graphiclayer is bound to the query result using // graphicProvider="{queryTask.executeLastResult.features}" } function onFault(info:Object,token:Object = null):void { Alert.show(info.toString(),"Query Problem"); } } ]]> </fx:Script> <fx:Declarations> <!-- Layer with US States --> <esri:QueryTask id="queryTask" showBusyCursor="true" url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0" useAMF="false"/> <esri:Query id="query" outSpatialReference="{myMap.spatialReference}" returnGeometry="true" text="{qText.text}"> <esri:outFields> <fx:String>CITY_NAME</fx:String> <fx:String>STATE_NAME</fx:String> </esri:outFields> </esri:Query> <esri:InfoSymbol id="infoSymbol1"> <esri:infoRenderer> <fx:Component> <mx:VBox> <mx:Label text="{data.CITY_NAME}"/> <mx:Label text="{data.STATE_NAME }"/> </mx:VBox> </fx:Component> </esri:infoRenderer> </esri:InfoSymbol> </fx:Declarations> <s:Panel backgroundColor="0xB2BFC6" height="60" title="Query a layer (search for a state)"> <s:layout> <s:HorizontalLayout/> </s:layout> <s:TextInput id="qText" enter="doQuery()" text="San Jose" width="100%"/> <s:Button click="doQuery()" label="Do Query"/> </s:Panel> <esri:Map id="myMap"> <esri:extent> <esri:Extent xmin="-14298000" ymin="2748000" xmax="-6815000" ymax="7117000"> <esri:SpatialReference wkid="102100"/> </esri:Extent> </esri:extent> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer"/> <esri:GraphicsLayer id="myGraphicsLayer" graphicProvider="{queryTask.executeLastResult.features}" symbol="{infoSymbol1}"/> </esri:Map> </s:Application> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |