加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ArcGIS Server Felx API接入E都市三维地图

发布时间:2020-12-15 03:59:51 所属栏目:百科 来源:网络整理
导读:ArcGIS Server Felx API 接入 E 都市三维地图 (本实例只是个人兴趣研究,如果想要应用到商业用途,请联系相关厂家) 通过 HttpWatch 工具查看 E 都市网站加载三维地图的方式及原理,能够观察到其加载的方式是通过切片的方式进行加载,但不同城市的地址不一

ArcGIS Server Felx API接入E都市三维地图

(本实例只是个人兴趣研究,如果想要应用到商业用途,请联系相关厂家)

通过HttpWatch工具查看E都市网站加载三维地图的方式及原理,能够观察到其加载的方式是通过切片的方式进行加载,但不同城市的地址不一样,需要根据实际情况调整切片加载的位置保证其在实际的位置,而且相互之间不压盖。观察每幅切片的加载地址,推测出其加载的算法,继承ArcGIS ServerFlex APITiledMapServiceLayer类,实现E都市地图服务数据的接入。具体代码如下:

packagecom.esri.viewer.components.common.edushi

{

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;

importflashx.textLayout.formats.Float;

public classEdushiTiledMapServiceLayer extends TiledMapServiceLayer

{

private var_tileInfo:TileInfo = new TileInfo();

private var_wkid:int = 102100;

private varcornerCoordinate:Number = 20037508.342787;

public functionEdushiTiledMapServiceLayer()

{

super();

buildTileInfo();

setLoaded(true);

}

override publicfunction get fullExtent():Extent

{

return newExtent(-cornerCoordinate,-cornerCoordinate,cornerCoordinate,new SpatialReference(_wkid));

}

override publicfunction get initialExtent():Extent

{

return newExtent(-cornerCoordinate,new SpatialReference(_wkid));

}

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 url:String =“”;

var num:Number =10-level;

if (num == 3)

{

url =“http://cpic2.edushi.com/cn/beijing/zh-chs/mappic/png” + (num) + “/” + (col-20)+ “,” + (row-20) + “.png”;

}

else if (num ==2)

{

url =“http://cpic2.edushi.com/cn/beijing/zh-chs/mappic/png” + (num) + “/” + (col-40)+ “,” + (row-40) + “.png”;

}

else if (num ==1)

{

url =“http://cpic2.edushi.com/cn/beijing/zh-chs/mappic/png” + (num) + “/” + (col-80)+ “,” + (row-80) + “.png”;

}

?

return newURLRequest(url);

}

private functionbuildTileInfo():void

{

_tileInfo.height=256;

_tileInfo.width=256;

_tileInfo.origin=newMapPoint(-cornerCoordinate,cornerCoordinate);

_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)

];

}

}

?

}

?

加载方式:

varpEdushiTiledMapServiceLayer: EdushiTiledMapServiceLayer = newEdushiTiledMapServiceLayer();

?

map.addLayer(_pEdushiTiledMapServiceLayer,-1);

?

运行结果如下:

以上实现了ArcGIS Server Flex API接入E都市三维地图的功能。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读