ArcGIS Viewer for Flex加载地图服务
1 建立flex项目将ArcGIS Viewer for Flex API加载到libs文件夹下(agslib-3.2-2013-03-19.swc),并在项目-属性-flex构建路径-库路径中将其添加进去
2 定义坐标系
1 <fx:Declarations> 2 <!-- 4326为经纬度坐标系,12100为投影坐标系 --> 3 <esri:SpatialReference id="sr" wkid="4326" /> 4 </fx:Declarations>
3 绘制地图
1 <esri:Map crosshairVisible="true" width="100%" height="100%" id="EsriMap"> 2 3 <!-- 加载已有的地图服务 --> 4 <esri:ArcGISTiledMapServiceLayer 5 url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/> 6 7 <!-- 定义图层 --> 8 <esri:GraphicsLayer id="EsriGraphicsLayer" spatialReference="{sr}" /> 9 10 <!-- 锁定初始的地图位置,当前为武汉,坐标系为4326(经纬度坐标系) --> 11 <esri:extent> 12 <esri:Extent id="mapExtent" xmin="112.00" ymin="29.50" xmax="116.50" ymax="31.65" /> 13 </esri:extent> 14 15 </esri:Map>