ArcGIS Server Flex API连接Googlemap
ArcGIS Server Flex API连接Googlemap (本实例只是个人兴趣研究,如果想要应用到商业用途,请联系相关厂家) ? ArcGIS Server Flex API连接Googlemap的地图数据,原理是通过访问Googlemap地图服务的切片数据,重载ArcGIS ServerFelx API的TiledMapServiceLayer接口类,主要实现了对于Googlemap影像切片数据、道路等POI切片数据和矢量切片数据的接入。 ? ? 以下为实现的完整代码 package com.esri.viewer.components.extensionMaps { importcom.esri.ags.SpatialReference; importcom.esri.ags.geometry.Extent; importcom.esri.ags.geometry.MapPoint; importcom.esri.ags.layers.TiledMapServiceLayer; importcom.esri.ags.layers.supportClasses.LOD; importcom.esri.ags.layers.supportClasses.TileInfo; importflash.net.URLRequest; ? //扩展TiledMapServiceLayer图层实现加载google地图 public classGoogleMapLayer extends TiledMapServiceLayer { private var_tileInfo:TileInfo = new TileInfo(); private var _baseURL:String=”"; private var_initialExtent:Extent; private var_wkid:int = 102113; ? public varmapType:String=”Map”; ? public functionGoogleMapLayer(initialExtent:Extent) { super(); ? _initialExtent =initialExtent; ? buildTileInfo(); setLoaded(true); } ? override publicfunction get fullExtent():Extent { return newExtent(-20037508.342787,-20037508.342787,20037508.342787,new SpatialReference(_wkid)); } ? override publicfunction get initialExtent():Extent { if(_initialExtent) return_initialExtent; ? returnfullExtent; } ? override publicfunction get spatialReference():SpatialReference { return newSpatialReference(wkid); } ? override publicfunction get tileInfo():TileInfo { return_tileInfo; } ? ? overrideprotected function getTileURL(level:Number,row:Number,col:Number):URLRequest { var s:String =“Galileo”.substring(0,((3 * x + y) % 8)); var url:String; //获取矢量地图 if(mapType ==“Map”) { url =“http://mt”+(col%4)+”.google.cn/vt/lyrs=m@158000000&hl=zh-CN&gl=cn&”+ “x=” + col +“&” + “y=” + row +“&” + “z=” + level+“&” + “s=” + s; } else if(mapType== “Image”)//获取影像地图 { url =“http://mt”+(col%4)+”.google.cn/vt/lyrs=s@101&hl=zh-CN&gl=cn&” + “x=” + col +“&” + “y=” + row +“&” + “z=” + level+“&” + “s=” + s; } else if(mapType== “POI”)//获取道路等POI,和影像地图配合使用 { url =“http://mt”+(col%4)+”.google.cn/vt/imgtp=png32&lyrs=h@169000000&hl=zh-CN&gl=cn&”+ “x=” + col +“&” + “y=” + row +“&” + “z=” + level+“&” + “s=” + s; } ? return newURLRequest(url); } ? private functionbuildTileInfo():void { _tileInfo.height=256; _tileInfo.width=256; _tileInfo.origin=newMapPoint(-20037508.342787,20037508.342787); _tileInfo.spatialReference=newSpatialReference(_wkid); _tileInfo.lods =[ new LOD(0,156543.033928,591657527.591555), new LOD(1,78271.5169639999,295828763.795777), new LOD(2,39135.7584820001,147914381.897889), new LOD(3,19567.8792409999,73957190.948944), new LOD(4,9783.93962049996,36978595.474472), new LOD(5,4891.96981024998,18489297.737236), new LOD(6,2445.98490512499,9244648.868618), new LOD(7,1222.99245256249,4622324.434309), new LOD(8,611.49622628138,2311162.217155), new LOD(9,305.748113140558,1155581.108577), new LOD(10,152.874056570411,577790.554289), new LOD(11,76.4370282850732,288895.277144), new LOD(12,38.2185141425366,144447.638572), new LOD(13,19.1092570712683,72223.819286), new LOD(14,9.55462853563415,36111.909643), new LOD(15,4.77731426794937,18055.954822), new LOD(16,2.38865713397468,9027.977411), new LOD(17,1.19432856685505,4513.988705), new LOD(18,0.597164283559817,2256.994353), new LOD(19,0.298582141647617,1128.497176) ]; } } } ? 需要确定googlemap地图服务的坐标系和地图服务的地址。 ? ? 运行结果为 ? 图一、矢量数据 ? 图二、影像数据 ? 图三、混合模式 ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 什么Visual C设置/选项/标志是-ansi -pedantic的对应部分
- C#泛型可以这么酷吗?
- [Swift]LeetCode897. 递增顺序查找树 | Increasing Order S
- Flex前端与Java服务端交互,反射机制挑大旗
- 升级到ruby 1.9.2并在nokogiri中获得Segmentation Fault错误
- 在C#中格式化为double
- cocos2dx3.1.1版本 向eclipse上移植Android项目
- emacs:是否可以将带有平衡parens的字符串与emacs正则表达式
- c# – 尝试精确测量2D图像的3D距离
- FastJson syntax error, pos 19