重写ArcGIS的TiledMapServiceLayer调用天地图瓦片
require(["esri/layers/TiledMapServiceLayer"], function () {
dojo.declare("com.StrongIt.Map.Layers.LayerTianditu", esri.layers.TiledMapServiceLayer, {
_mapStyle: "",
constructor: function (mapStyle, startLevel, endLevel) {
this._mapStyle = mapStyle;
this.spatialReference = new esri.SpatialReference({
wkid: 4326
});
this.initialExtent = new esri.geometry.Extent(73.5, 4, 135, 53.5, this.spatialReference);
this.fullExtent = new esri.geometry.Extent(-180.0, -90.0, 180.0, 90.0, this.spatialReference);
this.tileInfo = new esri.layers.TileInfo({
"dpi": "90.71428571427429",
"format": "image/png",
"compressionQuality": 0,
"rows": 256,
"cols": 256,
"compressionQuality": 0,
"origin": {
"x": -180,
"y": 90
},
"spatialReference": {
"wkid": 4326
},
"lods": this._getLods(startLevel, endLevel)
});
this.loaded = true;
this.onLoad(this);
},
getTileUrl: function (level, row, col) {
var serviceNum = col % 8;
var mapInfo = this._getMapInfo();
return "http://t"
+ serviceNum
+ ".tianditu.com/DataServer?T=" + mapInfo.mapName + "&" +
"X=" + col + "&" +
"Y=" + row + "&" +
"L=" + level;
},
_getLods: function (startLevel, endLevel) {
var lods = [];
var minScale = 590995186.1175;
var maxResolution = 1.40625;
var tempScale = minScale;
var tempResolution = maxResolution;
for (var i = 0; i <= endLevel; i++) {
var lod = {
"level": i,
"resolution": tempResolution,
"scale": tempScale
}
if (i >= startLevel) {
lods.push(lod);
}
tempScale = tempScale / 2;
tempResolution = tempResolution / 2;
}
return lods;
},
_getMapInfo: function () {
var result = {
mapName: "",
layerId: "",
tileMatrixSetId: ""
};
if(this._mapStyle == "ImageBaseMap") {
// 获取影像(底图)
result.mapName = "img_c";
result.layerId = "img";
result.tileMatrixSetId = "c";
} else if(this._mapStyle == "ImageCNNote") {
// 获取影像(中文注记)
result.mapName = "cia_c";
result.layerId = "cia";
result.tileMatrixSetId = "c";
} else if(this._mapStyle == "ImageENNote") {
// 获取影像(英文注记)
result.mapName = "eia_c";
result.layerId = "eia";
result.tileMatrixSetId = "c";
} else if(this._mapStyle == "TerrainBaseMap") {
// 获取地形图(底图)
result.mapName = "ter_c";
result.layerId = "ter";
result.tileMatrixSetId = "c";
} else if(this._mapStyle == "TerrainCNNote") {
// 获取地形图(中文注记)
result.mapName = "cta_c";
result.layerId = "cta";
result.tileMatrixSetId = "c";
} else if(this._mapStyle == "TerrainENNote") {
// 获取地形图(英文注记)
} else if(this._mapStyle == "VectorBaseMap") {
// 获取地图(底图)
result.mapName = "vec_c";
result.layerId = "vec";
result.tileMatrixSetId = "c";
} else if(this._mapStyle == "VectorCNNote") {
// 获取地图(中文注记)
result.mapName = "cva_c";
result.layerId = "cva";
result.tileMatrixSetId = "c";
} else if(this._mapStyle == "VectorENNote") {
// 获取地图(英文注记)
result.mapName = "eva_c";
result.layerId = "eva";
result.tileMatrixSetId = "c";
}
return result;
}
});
});
重写ArcGIS的TiledMapServiceLayer调用天地图瓦片的更多相关文章
- 重写ArcGIS的TiledMapServiceLayer呼叫世界地图图块
require(["esri/layers/TiledMapServiceLayer"], function () { dojo.declare("com.Str ...
- Arcgis for js载入天地图
综述:本节讲述的是用Arcgis for js载入天地图的切片资源. 天地图的切片地图能够通过esri.layers.TiledMapServiceLayer来载入.在此将之进行了一定的封装,例如以下 ...
- OpenLayer3调用天地图示例
最近,工作中有需要用Openlayer3脚本库调用天地图的wmts服务接口,由于这两个都是刚开始接触,所以是摸着石头过河,遇到了地图显示不了的问题,虽然官网http://www.zjditu.cn/r ...
- Leaflet 调用百度瓦片地图服务
在使用 leaflet 调用第三方瓦片地图服务的项目,主要谷歌地图.高德地图.百度地图和 OSM 地图,与其他三种地图对比,百度地图的瓦片组织方式是不同的.百度从中心点经纬度(0,0)度开始计算瓦片, ...
- 如何使用借助python完成 ARCGIS工具箱的调用
上个月使用python调用arcgis工具箱完成了火点txt文件转shp文件的小功能, 感觉很不错, 写下这篇博客希望对大家有所帮助. 1.环境介绍: 系统: win8.1(64位) arcgis:d ...
- arcgis js之调用wms服务
arcgis js之调用wms服务 定义: export const tdtlayer = async () => { let WMSLayer = await arcgisPackage.WM ...
- 2019年以后ArcGIS 调用天地图的资源URL
2019年1月1日起,天地图做出如下变更,导致直接在Arcgis/ArcMap中添加WMTS服务不能用了. 国家天地图解释的很清楚,注册个人用户就可以了. 原有调用方式不变,只要在URL 后添加“&a ...
- 重写 final关键字 多态调用子类特有的属性及行为(向上向下转型)
1.override 重写:在继承中,子类与父类方法名相同,参数列表相同,的方法叫重写,与返回值有关; 主要应用于系统升级. 2.final 关键字: 可修饰:1.类-->被修饰后该类不能被继 ...
- 一个对象toString()方法如果没有被重写,那么默认调用它的父类Object的toString()方法,而Object的toString()方法是打印该对象的hashCode,一般hashCode就是此对象的内存地址
昨天因为要从JFrame控件获取密码,注意到一个问题,那就是用toString方法得到的不一定是你想要的,如下: jPasswordField是JFrame中的密码输入框,如果用下面的方法是得不到密码 ...
随机推荐
- 【春训团队赛第四场】补题 | MST上倍增 | LCA | DAG上最长路 | 思维 | 素数筛 | 找规律 | 计几 | 背包 | 并查集
春训团队赛第四场 ID A B C D E F G H I J K L M AC O O O O O O O O O 补题 ? ? O O 传送门 题目链接(CF Gym102021) 题解链接(pd ...
- Scratch可视化的编程工具
1.是什么? 在线编程网址 是一个编程软件,但是不涉及编程语言,是针对青少年开发的编程积木模块. 2.软件的目的是什么? 激发青少年对编程的兴趣 3.怎么用呢? 软件内部是很多积木模块,需要明白每块是 ...
- nodejs安装失败
原文链接:https://www.cnblogs.com/huiziblog666/p/6274494.html 出现error 2502 和error2503是因为win8的权限问题所导致的,具体说 ...
- 禁止html复制文本
<body class="content" oncontextmenu="return false" onselectstart="return ...
- Python入门习题6.猜数游戏和其异常处理
例6:在程序中预设一个0~9之间的整数,让用户通过键盘输入所猜的数,如果大于预设的数,显示“遗憾,太大了”:小于预设的数,显示“遗憾,太小了”,如此循环,直至猜中数,显示”预测N次,猜中了”,其中N是 ...
- Codeforces 1166E(思维)
题面 有一个长度为n的序列a,有m次操作.每一次操作一个人选a的一个子集x,另一个人会选x的补集y.且x集合中的数的最小公倍数比y集合中的数的最小公倍数大.现在给出所有x,判断是否有一个序列a满足条件 ...
- JS的组成和变量
JavaScript中的变量和数据类型 Js做客户端语言 按照相关的Js语法,去操作页面中的元素,有时还要操作浏览器里面的一些功能 Js由三部分组成: ECMAScript(ES):描述了该语言的语法 ...
- 2019-9-8-WPF-渲染原理
title author date CreateTime categories WPF 渲染原理 lindexi 2019-9-8 10:40:0 +0800 2018-7-15 16:2:47 +0 ...
- HDU4035 Maze 期望DP+树形DP(好题)
题意:有一个树形的迷宫,有N个房间(标号为1~N)以及N-1条通道将它们连通,一开始在1号房间,每进入一个房间i,有k[i]的概率被陷阱杀死回到房间1,有s[i]的概率找到出口逃离迷宫,如果没有找到出 ...
- PF_INET 与驱动
https://blog.csdn.net/trustnature/article/details/7849562 ? ? ?