本文主要是介绍Flex4 ArcGis地图服务操作,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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:ArcGISTiledMapServiceLayerurl="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" /></esri:Map></s:Application>
2.定位地图位置
<?xml version="1.0" encoding="utf-8"?><s:Applicationxmlns: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:ArcGISTiledMapServiceLayerurl="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>
这篇关于Flex4 ArcGis地图服务操作的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!