arcgis api for flex 學習筆記

arcgis api for flex 學習筆記
一、入門:
1、下載arcgis flex api,地址:http://resources.arcgis.com/content/arcgis-flex-api-download
2、解壓後,運行eclipse,工程右鍵屬性,"Flex 構建路徑","添加SWC",選中解壓目錄中的SWC文件。
3、切換到Flash視圖,新建“MXML應用程序”。
4、打開http://help.arcgis.com/en/webapi/flex/samples/index.html,左欄菜單點“Mapping”,打開例子,查看源碼,複製到新建的工程中。運行即可。
二、管理地圖:
1、http://localhost:8099/arcgismanager登錄。
2、點擊鏈接“Publish a map, globe or other GIS resource as a service”。
3、“Resource”Browse按鈕,指向mxd文件,例如:C:\Program Files\ArcGIS\java\samples\data\mxds\usa.mxd。
4、假定地圖名爲usa,服務名也爲usa,其它按提示進行即可。
5、左欄,點擊Services,點擊新發布的地圖服務“usa”,即可看到縮略圖。
三、通過REST的接口使用ArcGIS功能:
1、http://localhost:8399/arcgis/rest
2、點擊Services:下的usa。
注意:有時你新發布了一個服務,但是在這裏卻看不到,這是由於緩存機製造成的,可以登錄http://localhost:8399/arcgis/rest/admin,然後使用ArcGis Server管理員帳號登錄,點擊"Clear Cache Options"下的“Clear Cache Now”鏈接,清除舊的REST緩存。
3、點擊“Export Map”,這個操作的URL是這樣的:http://localhost:8399/arcgis/rest/services/usa/MapServer/export?bbox=-183.78001472868405,16.300709121618663,-61.406854669684265,74.03030803096895
四、使用自己發佈的地圖:
在新建的MXML文件中複製以下代碼:
<?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="World Topographic Map">
 <esri:Map>
        <esri:ArcGISDynamicMapServiceLayer url="http://localhost:8399/arcgis/rest/services/usa/MapServer"/>
    </esri:Map>
</s:Application>
   其中,http://localhost:8399/arcgis/rest/services/usa/MapServer就是上面新建的地圖服務,具體地址可以使用第三條中提到的http://localhost:8399/arcgis/rest查看,“Export Map”取到MapServer爲止即可。
   Flex下的Map控件支持ArcGISDynamicMapServiceLayer 、ArcGISImageServiceLayer、ArcGISTiledMapServiceLayer、ArcIMSMapServiceLayer 、GraphicsLayer等幾種類型的layer,這些類型的layer區別其實看名字就能知道區別了,比如ArcGISDynamicMapServiceLayer就是支持ArcGIS Server發佈的普通的地圖服務,ArcGISTiledMapServiceLayer支持ArcGIS.Server發佈的切片緩存地圖。。。
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章