ArcGIS For Flex学习之Mapping---Switching Basemaps
2014-10-21 13:53
232 查看
今天开始系统的学习ArcGIS For Flex,先从ESRI的例子学起
转载地址:https://developers.arcgis.com/flex/sample-code/switching-basemaps.htm
<?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="Toggle between Map Services"> <!-- Description: This sample demonstrates how to allow users to change between different basemaps. There are different ways to visually accomplish this behavior, this is just one example. It also ensures that the levels of detail (LOD) are updated based on which basemap is selected. If all base maps have the same LODs, you wouldn't need the layerShowHandler function. Documentation: For more information, see the API documentation. http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/geometry/MapPoint.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/TiledMapServiceLayer.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/TiledMapServiceLayer.html#tileInfo http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/supportClasses/TileInfo.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/supportClasses/LOD.html http://resources.arcgis.com/en/help/flex-api/concepts/index.html#/Types_of_layers/017p00000027000000/ ArcGIS REST API documentation: http://resources.arcgis.com/en/help/rest/apiref/mapserver.html http://resources.arcgis.com/en/help/rest/apiref/tile.html ArcGIS for Server documentation: http://resources.arcgis.com/en/help/main/10.1/#/What_is_a_map_service/0154000002m7000000/ http://resources.arcgis.com/en/help/main/10.1/#/What_is_map_caching/01540000048q000000/ --> <fx:Script> <![CDATA[ import com.esri.ags.geometry.MapPoint; import com.esri.ags.layers.TiledMapServiceLayer; import mx.events.FlexEvent; private function layerShowHandler(event:FlexEvent):void { // update the LODs/zoomslider to use/show the levels for the selected base map var tiledLayer:TiledMapServiceLayer = event.target as TiledMapServiceLayer; myMap.lods = tiledLayer.tileInfo.lods; } ]]> </fx:Script> <s:controlBarContent> <s:RichText width="100%"> This sample demonstrates how to allow users to change between different basemaps. There are different ways to visually accomplish this behavior, this is just one example. Click the different buttons on the bar below to switch basemaps. </s:RichText> </s:controlBarContent> <esri:Map id="myMap" level="4" load="myMap.centerAt(new MapPoint(-11713000, 4822000))"> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" visible="{bb.selectedIndex == 0}"/> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" visible="{bb.selectedIndex == 1}"/> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" visible="{bb.selectedIndex == 2}"/> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" visible="{bb.selectedIndex == 3}"/> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" visible="{bb.selectedIndex == 4}"/> </esri:Map> <s:ButtonBar id="bb" right="5" top="5" requireSelection="true"> <s:dataProvider> <s:ArrayList> <fx:String>Streets</fx:String> <fx:String>Topographic</fx:String> <fx:String>Imagery</fx:String> <fx:String>Oceans</fx:String> <fx:String>National Geographic</fx:String> </s:ArrayList> </s:dataProvider> </s:ButtonBar> </s:Application>
转载地址:https://developers.arcgis.com/flex/sample-code/switching-basemaps.htm
相关文章推荐
- ArcGIS For Flex学习之Mapping---Select and zoom
- ArcGIS For Flex学习之Mapping---Add LODs for extra zooming
- <API 2.0>Switching Basemaps
- ArcGIS For Flex学习之Mapping---Map Extent and Mouse Coordinates
- ArcGIS学习(五)OpenLayers调用WMS服务
- ArcGis学习笔记 1: 资料收集,下载,安装,迷糊
- 学习Opera:设置signed.applets.codebase_principal_support
- ARCGIS学习的网站
- Jsp&Servelet 学习笔记-对一个Servlet创建多个Mapping
- DirectShow学习(二)CBasePin类、CBaseOutputPin类和CBaseInputPin类源代码解析
- 关于OR-Mapping的学习心得体会
- ArcGIS学习(三)ArcSDE
- ArcGIS学习(一)初识ArcGIS
- (转)ArcGIS API for Flex入门 - 7.API学习路线
- 【转】ArcGIS空间分析模块学习指南(九、十、十一)
- arcgis server 学习(四) arcgis server中的几种点对象
- ArcGIS Desktop 9.2学习笔记-1
- Struts学习 错误:exception: cannot find actionmappings or actionformbeans collection
- ArcGIS学习(二)ArcGIS Server
- 【转】ArcGIS空间分析模块学习指南(三、四、五、六、七、八)---表面分析工具