日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

arcgis api for flex 开发入门(二)map 的创建

發(fā)布時間:2025/7/14 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 arcgis api for flex 开发入门(二)map 的创建 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

arcgis api for flex 開發(fā)入門(二)map 的創(chuàng)建
在flex 中創(chuàng)建一個esri 的map ,你只需要使用<esri:Map>標簽就可以輕松完成。
在<esri:Map>標簽中可以添加屬性和響應(yīng)事件的消息。
如下:
<esri:Map width="100%" height="50%" id="EsriMap" creati??resize="EsriMapResize(event);" extentChange="ESRIMapExtentChange(event);" mouseMove="OnDrawMouseMove(event)" />
width和 height定義的map 的大小,id="EsriMap" 唯一標識了這個map。
針對map 的消息也有很多,最常用的就是creationComplete,resize和鼠標消息了。
現(xiàn)在我們map有了,那么我們?nèi)绾巫屗@示數(shù)據(jù)呢,這就需要給 <esri:Map>標簽添加一個layer 子標簽? ?。
在ags flex api 中有以下幾種類型的layer。? ?
??ArcGISDynamicMapServiceLayer :Allows you to work with a dynamic map service resource exposed by the ArcGIS Server REST API.
??ArcGISImageServiceLayer: Allows you to work with an image service resource exposed by the ArcGIS Server REST API.
??ArcGISMapServiceLayer :The base class for ArcGIS Server map services.
??ArcGISTiledMapServiceLayer :Allows you to work with a cached map service resource exposed by the ArcGIS Server REST API.
??ArcIMSMapServiceLayer :Allows you to work with an ArcIMS image service.
??GPResultImageLayer :Allows you to view a geoprocessing task result identified by jobId and parameterName.
??GraphicsLayer: A layer that contains one or more Graphic features.
其中GraphicsLayer是支持客戶端添加Graphic features的圖層,需要在客戶端表現(xiàn)的,或者交互操作中產(chǎn)生的要素都要加到這個layer 上。
下面,我們就添加一個ArcGISTiledMapServiceLayer和GraphicsLayer到map 上。

<esri:Map width="100%" height="50%" id="EsriMap" creati??resize="EsriMapResize(event);" extentChange="ESRIMapExtentChange(event);" mouseMove="OnDrawMouseMove(event)" >
<esri:ArcGISTiledMapServiceLayer? ?? ?? ???url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
<esri:GraphicsLayer id="myGraphicsLayer" spatialReference="{sr}"/>
</esri:Map>
其中<esri:ArcGISTiledMapServiceLayer>標簽中的url 屬性為提供該服務(wù)的地址。<esri:GraphicsLayer>標簽其中的spatialReference屬性定義了該圖層的空間參考系。
創(chuàng)建一個空間參考系,只需要使用<esri:SpatialReference>標簽就可以了,其中wkid 是esri已經(jīng)定義好的空間草考系的ID,具體ID對應(yīng)的空間參考可以在http://resources.esri.com/help/9.3/arcgisserver/apis/REST/index.html?gcs.html中查找。如下為創(chuàng)建一個kid="4326"的空間參考系。
<esri:SpatialReference id="sr" wkid="4326"/>
那么,我們?nèi)绾味x我們想顯示的范圍呢?
很簡單,在<esri:Map>下面添加<esri:extent>子標簽,我們就可以來控制當前的顯示范圍了。
? ? <esri:extent>
??<esri:Extent??id = "esriMapExtent" xmin="116" ymin="39.5" xmax="116.5" ymax="40.5"/>
</esri:extent>
其中x是經(jīng)度,y 是緯度。
這樣一個北京地區(qū)的map 就可以顯示到我們面前了。
完整代碼如下

Code
<?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
="Using?ArcGIS?API?for?Flex?to?connect?to?a?cached?ArcGIS?Online?service"

????styleName
="plain">

????
<esri:SpatialReference?id="sr"?wkid="4326"/>

????
<esri:Map?crosshairVisible="true">

????????
<esri:extent>

??
<esri:Extent??id?=?"esriMapExtent"?xmin="116"?ymin="39.5"?xmax="116.5"?ymax="40.5"/>

??
</esri:extent>

????????
<esri:ArcGISTiledMapServiceLayer

????????????url
="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"?/>

?????
<esri:GraphicsLayer?id="myGraphicsLayer"?spatialReference="{sr}"/>

????
</esri:Map>

</mx:Application>

?

原文地址:http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=35537&extra=page%3D4%26amp%3Borderby%3Ddateline



本文轉(zhuǎn)自溫景良(Jason)博客園博客,原文鏈接:http://www.cnblogs.com/wenjl520/archive/2009/06/02/1494536.html,如需轉(zhuǎn)載請自行聯(lián)系原作者

總結(jié)

以上是生活随笔為你收集整理的arcgis api for flex 开发入门(二)map 的创建的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。