Commit e10f8fe6 authored by 邹绪超's avatar 邹绪超

feat: 引入高德地图

parent 1ff75e0b
Pipeline #20770 passed with stages
in 2 minutes 33 seconds
...@@ -127,6 +127,7 @@ ...@@ -127,6 +127,7 @@
], ],
"dependencies": { "dependencies": {
"cross-spawn": "^7.0.3", "cross-spawn": "^7.0.3",
"esri-loader": "^2.16.0" "esri-loader": "^2.16.0",
"lodash": "^4.17.20"
} }
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"author": "zouxuchao", "author": "zouxuchao",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"esri-loader": "^2.16.0" "esri-loader": "^2.16.0",
"lodash": "^4.17.20"
} }
} }
const url = 'https://webapi.amap.com/maps?v=1.4.15&key=e83f64300a2a55a33fa8e4ab9a46bca6';
const plugins = ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.DistrictSearch'];
const amapConfig = { url, plugins };
export default amapConfig;
const DEFAULT_WORKER_URL = 'https://panda-water.cn/web4/framework/4.9/';
const gisConfig = {
baseURL: DEFAULT_WORKER_URL,
url: DEFAULT_WORKER_URL + 'init.js',
css: DEFAULT_WORKER_URL + 'gis/css/main.css',
dojoConfig: {
has: {
'gis-featurelayer-webgl': 1,
},
aliases: [
[
/^webgl-engine/,
function () {
return 'gis/views/3d/webgl-engine';
},
],
[
/^engine/,
function () {
return 'gis/views/3d/webgl-engine';
},
],
[
/^gis-hydra/,
function () {
return 'gis';
},
],
['text', 'dojo/text'],
],
async: 1,
async: 1,
baseUrl: './',
packages: [
{
location: DEFAULT_WORKER_URL + 'dojo',
name: 'dojo',
},
{
location: DEFAULT_WORKER_URL + 'dijit',
name: 'dijit',
},
{
location: DEFAULT_WORKER_URL + 'dojox',
name: 'dojox',
},
{
location: DEFAULT_WORKER_URL + 'dgrid',
main: 'OnDemandGrid',
name: 'dgrid',
},
{
location: DEFAULT_WORKER_URL + 'dstore',
main: 'Store',
name: 'dstore',
},
{
location: DEFAULT_WORKER_URL + 'gis',
name: 'gis',
},
{
location: DEFAULT_WORKER_URL + 'moment',
main: 'moment',
name: 'moment',
},
{
location: DEFAULT_WORKER_URL + '@dojo',
name: '@dojo',
},
{
location: DEFAULT_WORKER_URL + 'cldrjs',
main: 'dist/cldr',
name: 'cldrjs',
},
{
location: DEFAULT_WORKER_URL + 'globalize',
main: 'dist/globalize',
name: 'globalize',
},
{
location: DEFAULT_WORKER_URL + 'maquette',
main: 'dist/maquette.umd',
name: 'maquette',
},
{
location: DEFAULT_WORKER_URL + 'maquette-css-transitions',
main: 'dist/maquette-css-transitions.umd',
name: 'maquette-css-transitions',
},
{
location: DEFAULT_WORKER_URL + 'maquette-jsx',
main: 'dist/maquette-jsx.umd',
name: 'maquette-jsx',
},
{
location: DEFAULT_WORKER_URL + 'tslib',
main: 'tslib',
name: 'tslib',
},
],
hasCache: {
'config-deferredInstrumentation': 0,
'config-selectorEngine': 'acme',
'config-tlmSiblingOfDojo': 1,
'dojo-built': 1,
'dojo-has-api': 1,
'dojo-loader': 1,
'dojo-undef-api': 0,
dom: 1,
'host-browser': 1,
'gis-built': 1,
'gis-featurelayer-webgl': 0,
'gis-promise-compatibility': !1,
'gis-promise-compatibility-deprecation-warnings': !1,
},
map: {
globalize: {
cldr: 'cldrjs/dist/cldr',
'cldr/event': 'cldrjs/dist/cldr/event',
'cldr/supplemental': 'cldrjs/dist/cldr/supplemental',
'cldr/unresolved': 'cldrjs/dist/cldr/unresolved',
},
},
},
};
export default gisConfig;
export default [
'gis/Map',
'gis/Basemap',
'gis/views/MapView',
'gis/views/SceneView',
'gis/layers/TileLayer',
'gis/layers/MapImageLayer',
'gis/layers/ElevationLayer',
'gis/Ground',
'gis/layers/SceneLayer',
'gis/layers/FeatureLayer',
'gis/layers/GroupLayer',
'gis/layers/VectorTileLayer',
'gis/layers/OpenStreetMapLayer',
'gis/geometry/Extent',
'gis/core/Collection',
'gis/Camera',
'gis/Viewpoint',
'gis/geometry/support/jsonUtils',
'gis/core/watchUtils',
'gis/Graphic',
'gis/symbols/PictureMarkerSymbol',
'gis/widgets/Popup',
'gis/layers/GraphicsLayer',
'dojox/gfx/matrix',
'gis/Color',
'gis/symbols/SimpleFillSymbol',
'gis/symbols/SimpleLineSymbol',
'gis/symbols/TextSymbol',
'gis/geometry/Point',
'dojo/_base/lang',
'gis/core/promiseUtils',
];
import { CreateMap } from '../index'; import mapsettings from '../mapData';
import MapManganer from '../index';
export default () => { export default () => {
return <CreateMap />; return <MapManganer mapsettings={mapsettings} />;
}; };
// All material copyright GIS, All Rights Reserved, unless otherwise specified.
// See https://js.gis.com/4.3/gis/copyright.txt for details.
//>>built
define('require exports gis/core/tsSupport/declareExtendsHelper gis/core/tsSupport/decorateHelper gis/core/Accessor gis/core/accessorSupport/decorators'.split(
' ',
), function (c, k, g, f, h, e) {
c = (function (c) {
function b() {
var a = c.call(this) || this;
a._groups = null;
a._groups = {};
return a;
}
g(b, c);
b.prototype.destroy = function () {
this.removeAll();
this._groups = null;
};
Object.defineProperty(b.prototype, 'size', {
get: function () {
var a = 0,
d = this._groups,
b;
for (b in d) a += d[b].length;
return a;
},
enumerable: !0,
configurable: !0,
});
b.prototype.add = function (a, b) {
if (!this._isPromise(a) && !Array.isArray(a)) return this;
b = this._getOrCreateGroup(b);
if (Array.isArray(a)) for (var d = 0; d < a.length; d++) b.push(a[d]);
else b.push(a);
this.notifyChange('size');
return this;
};
b.prototype.has = function (a) {
a = this._groups[a];
return !!a && 0 < a.length;
};
b.prototype.remove = function (a) {
if (Array.isArray(a)) a.forEach(this.remove.bind(this));
else {
a = this._getGroup(a);
if (!a) return this;
for (var b = 0; b < a.length; b++)
!a[b].isFulfilled() && !a[b].isCanceled() && a[b].cancel();
a.length = 0;
this.notifyChange('size');
}
return this;
};
b.prototype.removeAll = function () {
var a = this._groups,
b;
for (b in a) this.remove(b), delete a[b];
return this;
};
b.prototype._isPromise = function (a) {
return a && !!a.cancel && !!a.isCanceled;
};
b.prototype._getOrCreateGroup = function (a) {
return this._getGroup(a) || (this._groups[this._ensureGroupName(a)] = []);
};
b.prototype._getGroup = function (a) {
return this._groups[this._ensureGroupName(a)];
};
b.prototype._ensureGroupName = function (a) {
return a || '_default_';
};
return b;
})(e.declared(h));
f([e.property({ readOnly: !0 })], c.prototype, 'size', null);
return (c = f([e.subclass()], c));
});
import TilemetaUtils from './support/TilemetaUtils';
export default function (TileLayer, lang, promiseUtils) {
var dpi = 96, //pixel per inch
level = 99, //地图缩放级数
maxlevel = 18, //地图总级数
levelStart = 3, // 起始级数
resolution_0 = 156543.0339280234, //第0级分辨率 米/像素
tileSize = 256, //瓦片大小
format = 'PNG', //图片格式
wkid = 4526, //102113
fullExtent = [705289.3147226945, 206299.30564637203, 19490490.956488788, 8865103.18739793], //[-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892]
origin = { x: -20037508.3427892, y: 20037508.3427892 }, //裁图原点
server = {
//出图服务参数
count: 4, //服务总数
start: 1, //服务起始编号
seq: 0, //当前请求编号
//矢量
'amap-v':
window.location.protocol +
'//webrd0{num}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale={scale}&style=8&x={col}&y={row}&z={level}&type=map',
//影像
'amap-i':
window.location.protocol +
'//webst0{num}.is.autonavi.com/appmaptile?style=6&x={col}&y={row}&z={level}&type=map',
//影像注记
'amap-ia':
window.location.protocol +
'//webst0{num}.is.autonavi.com/appmaptile?x={col}&y={col}&z={level}&lang=zh_cn&size=1&scale={scale}&style=8&type=map',
//矢量x2
'amap-v2':
window.location.protocol +
'//webrd0{num}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale={scale}&style=8&x={col}&y={row}&z={level}&scl=2&type=map',
//影像x2
'amap-i2':
window.location.protocol +
'//webst0{num}.is.autonavi.com/appmaptile?style=6&x={col}&y={row}&z={level}&scl=2&type=map',
//影像注记x2
'amap-ia2':
window.location.protocol +
'//webst0{num}.is.autonavi.com/appmaptile?x={col}&y={col}&z={level}&lang=zh_cn&size=1&scale={scale}&style=8&type=map',
};
return TileLayer.createSubclass([], {
declaredClass: 'gis.layers.AMapTileLayer',
_fetchService: function () {
//重写 获取元数据,读取本地TileMetaData
return promiseUtils.resolve().then(
function () {
this.read(
TilemetaUtils.getTilemeta(
resolution_0,
dpi,
level,
levelStart,
wkid,
fullExtent,
origin,
tileSize,
format,
),
);
}.bind(this),
);
},
getTileUrl: function (level, row, col) {
//重写 获取瓦片服务地址
server.seq++, (server.seq %= server.count);
return maxlevel < level
? null
: lang.replace(server[this.layerType], {
num: server.seq + server.start,
row: row,
col: col,
level: level,
scale:
window.devicePixelRatio > 1
? window.devicePixelRatio
: Math.ceil(window.devicePixelRatio),
});
},
});
}
import TilemetaUtils from './support/TilemetaUtils';
//百度地图
export default function (TileLayer, promiseUtils) {
var dpi = 96, //pixel per inch
level = 99, //地图缩放级数
maxlevel = 20, //地图总级数
levelStart = 5, // 起始级数
resolution_0 = 262144, //第0级分辨率 米/像素
tileSize = 256, //瓦片大小
format = 'PNG', //图片格式
wkid = 4526, //102100
fullExtent = [3471225.2442693943, 685702.9352539922, 19199896.701612312, 7935637.435122993], //[-33554432,-33554432,33554432,33554432]
origin = { x: -33554432, y: 33554432 }, //裁图原点
ak = 'E4805d16520de693a3fe707cdc962045',
defaultStyles =
't:all|e:all|l:13|s:-51,t:road|e:all|l:39|s:-60,t:all|e:l.i|l:22|s:-100|h:#000000',
server = {
//出图服务参数
count: 10, //服务总数
start: 0, //服务起始编号
seq: 0, //当前请求编号
//矢量
'baidu-v':
window.location.protocol +
'//api<%=num%>.map.bdimg.com/customimage/tile?x=<%=col%>&y=<%=row%>&z=<%=level%>&scale=<%=scale%>&ak=<%=ak%>&styles=<%=styles%>&type=map',
//影像
'baidu-i':
window.location.protocol +
'//shangetu<%=num%>.map.bdimg.com/it/u=x=<%=col%>;y=<%=row%>;z=<%=level%>;v=009;type=sate&fm=46&type=map',
//影像注记
'baidu-ia':
window.location.protocol +
'//online<%=num%>.map.bdimg.com/onlinelabel/?qt=tile&x=<%=col%>&y=<%=row%>&z=<%=level%>&styles=sl&type=map',
};
return TileLayer.createSubclass([], {
declaredClass: 'gis.layers.BaiduTileLayer',
_fetchService: function () {
//重写 获取元数据,读取本地TileMetaData
this.isVector() && (server.count = 3);
return promiseUtils.resolve().then(
function () {
this.read(
TilemetaUtils.getTilemeta(
resolution_0,
dpi,
level,
levelStart,
wkid,
fullExtent,
origin,
tileSize,
format,
),
);
}.bind(this),
);
},
getTileUrl: function (level, row, col) {
//重写 获取瓦片服务地址
var tileCount = parseInt(Math.pow(2, level)),
col = col - tileCount / 2,
row = tileCount / 2 - row - 1;
server.seq++, (server.seq %= server.count);
return maxlevel < level
? null
: _.template(this.getServerUrl())({
num: server.seq + server.start,
row: row,
col: col,
level: level,
scale: window.devicePixelRatio,
styles: encodeURIComponent(this.url || defaultStyles),
ak: ak,
});
},
isVector: function () {
return this.layerType == 'baidu-v';
},
getServerUrl: function () {
var serverUrl = server[this.layerType];
return serverUrl;
},
});
}
// 谷歌地图 (由TileLayer扩展)
// create by czl 2017/12/2
import TilemetaUtils from './support/TilemetaUtils';
export default function (TileLayer, lang, promiseUtils) {
var dpi = 96, //pixel per inch
level = 99, //地图缩放级数
levelStart = 3, // 起始级数
maxlevel = 20, //地图总级数
resolution_0 = 156543.033880145821696, //第0级分辨率 米/像素
tileSize = 256, //瓦片大小
format = 'PNG', //图片格式
wkid = 4526, //102113
fullExtent = [705289.3147226945, 206299.30564637203, 19490490.956488788, 8865103.18739793], //[-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892]
origin = { x: -20037508.3427892, y: 20037508.3427892 }, //裁图原点
server = {
//出图服务参数
count: 4, //服务总数
start: 0, //服务起始编号
seq: 0, //当前请求编号
//矢量
'google-v':
window.location.protocol +
'//mt{num}.google.cn/vt/lyrs=m&gl=CN&x={col}&y={row}&z={level}&scale={scale}&type=map',
//影像
'google-i':
window.location.protocol +
'//mt{num}.google.cn/vt/lyrs=s&gl=CN&x={col}&y={row}&z={level}&scale={scale}&type=map',
//原始影像带注记
'google-i-a':
window.location.protocol +
'//mt{num}.google.cn/vt/lyrs=y&gl=CN&x={col}&y={row}&z={level}&scale={scale}&type=map',
//影像注记
'google-ia':
window.location.protocol +
'//mt{num}.google.cn/vt/lyrs=h&gl=CN&x={col}&y={row}&z={level}&scale={scale}&type=map',
};
return TileLayer.createSubclass([], {
declaredClass: 'gis.layers.GoogleTileLayer',
_fetchService: function () {
//重写 获取元数据,直接读取本地TileMetaData
return promiseUtils.resolve().then(
function () {
this.read(
TilemetaUtils.getTilemeta(
resolution_0,
dpi,
level,
levelStart,
wkid,
fullExtent,
origin,
tileSize,
format,
),
);
}.bind(this),
);
},
getTileUrl: function (level, row, col) {
//重写 获取瓦片服务地址
server.seq++, (server.seq %= server.count);
return maxlevel < level
? null
: lang.replace(server[this.layerType], {
num: server.seq + server.start,
row: row,
col: col,
level: level,
scale:
window.devicePixelRatio > 1
? window.devicePixelRatio
: Math.ceil(window.devicePixelRatio),
});
},
});
}
// All material copyright GIS, All Rights Reserved, unless otherwise specified.
// See https://js.gis.com/4.3/gis/copyright.txt for details.
//>>built
//streets、light、dark、satellite、streets-satellite、wheatpaste、streets-basic、comic、outdoors、run-bike-hike、pencil、pirates、emerald、high-contrast
define(['gis/config', 'gis/layers/WebTileLayer'], function (a, b) {
a.request.corsEnabledServers.push('a.tile.mapbox.org', 'b.tile.mapbox.org', 'c.tile.mapbox.org');
return b.createSubclass({
declaredClass: 'gis.layers.MapBoxLayer',
properties: {
copyright: 'Map data \x26copy; mapbox contributors, CC-BY-SA',
subDomains: { value: ['a', 'b', 'c'] },
urlTemplate:
'https://{subDomain}.tiles.mapbox.com/v4/mapbox.streets-basic/{level}/{col}/{row}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA',
operationalLayerType: 'mapbox',
type: { value: 'mapbox', json: { read: !1 } },
},
});
});
// 自定义底图 (由TileLayer扩展)
// create by zxc 2020/7/16
define([
'gis/layers/TileLayer',
'dojo/_base/lang',
'gis/core/promiseUtils',
'./support/TilemetaUtils',
'gis/request',
], function (TileLayer, lang, promiseUtils, TilemetaUtils, request) {
var dpi = 96, //pixel per inch
level = 99, //地图缩放级数
levelStart = 0, // 起始级数
maxlevel = 20, //地图总级数
resolution_0 = 156543.033880145821696, //第0级分辨率 米/像素 156543.033880145821696
tileSize = 256, //瓦片大小
format = 'PNG', //图片格式
wkid = 4526, //102113
fullExtent = [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892], //[-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892]
origin = {
x: -20037508.3427892,
y: 20037508.3427892,
}, //裁图原点
server = {
//出图服务参数
'pipenet-tile':
window.location.protocol +
'//{url}/gwc/service/wmts?layer={baseLayer}&tilematrixset={tileMatrix}&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix={tileMatrix}%3A{level}&TileCol={col}&TileRow={row}',
};
return TileLayer.createSubclass([], {
declaredClass: 'gis.layers.PipenetTileLayer',
_fetchService: function () {
//重写 获取元数据,直接读取本地TileMetaData
return promiseUtils.resolve().then(
function () {
if (this.extent && this.extent.split(',').length == 4)
fullExtent = [
parseFloat(this.extent.split(',')[0]),
parseFloat(this.extent.split(',')[1]),
parseFloat(this.extent.split(',')[2]),
parseFloat(this.extent.split(',')[3]),
];
if (this.levelStart && parseFloat(this.levelStart))
levelStart = parseFloat(this.levelStart);
if (this.resolution && parseFloat(this.resolution))
resolution_0 = parseFloat(this.resolution);
if (this.origin && this.origin.split(',').length == 2)
origin = {
x: parseFloat(this.origin.split(',')[0]),
y: parseFloat(this.origin.split(',')[1]),
};
this.read(
TilemetaUtils.getTilemeta(
resolution_0,
dpi,
level,
levelStart,
wkid,
fullExtent,
origin,
tileSize,
format,
),
);
}.bind(this),
);
},
getTileUrl: function (level, row, col) {
//重写 获取瓦片服务地址
return lang.replace(server[this.layerType], {
row: row,
col: col,
level: level,
baseLayer: this.baseLayer,
url: this.url,
tileMatrix: this.tileMatrix ? this.tileMatrix : 'EPSG102113',
});
},
fetchTile: function (level, row, col) {
let url = this.getTileUrl(level, row, col);
let isNeedImg = _.isUndefined(this.isNeedImg) ? true : !!this.isNeedImg;
if (isNeedImg) {
var imgSrc = this.fillImgSrc || 'assets/images/webgis/常用工具/透明.png';
var img = new Image();
img.src = imgSrc;
img.width = img.height = tileSize;
}
return request(url, {
responseType: 'image',
cachBust: true,
})
.then(
function (response) {
if (response.data) return response.data;
if (isNeedImg) return img;
return null;
}.bind(this),
)
.otherwise(
function (error) {
if (isNeedImg) return img;
return null;
}.bind(this),
);
},
});
});
// 天地图 (由TileLayer扩展)
// create by czl 2017/12/2
define([
'gis/layers/TileLayer',
'dojo/_base/lang',
'gis/core/promiseUtils',
'./support/TilemetaUtils',
], function (TileLayer, lang, promiseUtils, TilemetaUtils) {
var dpi = 96, //pixel per inch
level = 20, //地图总级数
levelStart = 3, // 起始级数
// levelStart = 11, // 起始级数
resolution_0 = 156543.0339280234, //第0级分辨率 米/像素
tileSize = 256, //瓦片大小
format = 'PNG', //图片格式
wkid = 4526, //102113
fullExtent = [705289.3147226945, 206299.30564637203, 19490490.956488788, 8865103.18739793], //[-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892]
origin = {
x: -20037508.3427892,
y: 20037508.3427892,
}, //裁图原点
wkid_ll = 4490,
resolution_0_ll = 0.703125,
// resolution_0_jn = 1.4881889763779584,
resolution_0_jn = 0.143984375,
fullExtent_jn = [-30.85, 60.594, -30.354, 61.327],
fullExtent_ll = [
-31.904360683593602,
60.32192850494357,
-29.267636660156114,
61.62381099151584,
],
// fullExtent_ll = [-57.854119614257556, 53.119002722167735, -15.666535239257712, 72.56484239501923],
origin_ll = {
x: -180,
y: 90,
},
server = {
//出图服务参数
count: 3, //服务总数
start: 0, //服务起始编号
seq: 0, //当前请求编号
//球形墨卡托
//矢量
'tianditu-v':
window.location.protocol +
'//t{num}.tianditu.com/DataServer?T=vec_w&x={col}&y={row}&l={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//矢量注记
'tianditu-va':
window.location.protocol +
'//t{num}.tianditu.com/DataServer?T=cva_w&x={col}&y={row}&l={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//影像
'tianditu-i':
window.location.protocol +
'//t{num}.tianditu.com/DataServer?T=img_w&x={col}&y={row}&l={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//影像注记
'tianditu-ia':
window.location.protocol +
'//t{num}.tianditu.com/DataServer?T=cia_w&x={col}&y={row}&l={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//地形
'tianditu-t':
window.location.protocol +
'//t{num}.tianditu.com/DataServer?T=ter_w&x={col}&y={row}&l={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//地形注记
'tianditu-ta':
window.location.protocol +
'//t{num}.tianditu.com/DataServer?T=cta_w&x={col}&y={row}&l={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//经纬度
//矢量
'tianditu-ll-v':
window.location.protocol +
'//t{num}.tianditu.com/vec_c/wmts/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=tiles&serviceMode=KVP&layer=vec&TileMatrixSet=c&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//矢量注记
'tianditu-ll-va':
window.location.protocol +
'//t{num}.tianditu.com/cva_c/wmts/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=tiles&serviceMode=KVP&layer=cva&TileMatrixSet=c&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//影像
'tianditu-ll-i':
window.location.protocol +
'//t{num}.tianditu.com/img_c/wmts/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=tiles&serviceMode=KVP&layer=img&TileMatrixSet=c&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//影像注记
'tianditu-ll-ia':
window.location.protocol +
'//t{num}.tianditu.com/cia_c/wmts/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=tiles&serviceMode=KVP&layer=cia&TileMatrixSet=c&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//地形
'tianditu-ll-t':
window.location.protocol +
'//t{num}.tianditu.com/ter_c/wmts/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=tiles&serviceMode=KVP&layer=ter&TileMatrixSet=c&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//地形注记
'tianditu-ll-ta':
window.location.protocol +
'//t{num}.tianditu.com/cta_c/wmts/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=tiles&serviceMode=KVP&layer=cta&TileMatrixSet=c&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//江宁图层
'tianditu-jn-jn':
window.location.protocol +
'//58.213.148.61:8083/GZ_DT_9_20/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=image%2Ftile&serviceMode=KVP&layer=gz_dt_9_20&TileMatrixSet=Matrix_gz_dt_9_20_0&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//江宁注记图层
'tianditu-jn-jna':
window.location.protocol +
'//58.213.148.61:8083/GZ_ZJ_9_20/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=image%2Ftile&serviceMode=KVP&layer=gz_zj_9_20&TileMatrixSet=Matrix_gz_zj_9_20_0&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
//江宁影像
'tianditu-jn-jni':
window.location.protocol +
'//58.213.23.212:7003/NJ_DSX_YX/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=image%2Ftile&serviceMode=KVP&layer=nj_dsx_yx&TileMatrixSet=Matrix_nj_dsx_yx_0&TileRow={row}&TileCol={col}&TileMatrix={level}&type=map&tk=eef0de4d706219489963a14e1c1263bb',
};
return TileLayer.createSubclass([], {
declaredClass: 'gis.layers.TiandituTileLayer',
_fetchService: function () {
//重写 获取元数据,读取本地TileMetaData
return promiseUtils.resolve().then(
function () {
var tilemeta =
this.layerType.indexOf('-ll-') == -1
? this.layerType.indexOf('-jn-') == -1
? TilemetaUtils.getTilemeta(
resolution_0,
dpi,
level,
levelStart,
wkid,
fullExtent,
origin,
tileSize,
format,
)
: TilemetaUtils.getTilemeta(
resolution_0_ll,
dpi,
level,
levelStart,
wkid_ll,
fullExtent_jn,
origin_ll,
tileSize,
format,
true,
)
: TilemetaUtils.getTilemeta(
resolution_0_ll,
dpi,
level,
levelStart,
wkid_ll,
fullExtent_ll,
origin_ll,
tileSize,
format,
true,
);
this.read(tilemeta);
}.bind(this),
);
},
getTileUrl: function (level, row, col) {
//重写 获取瓦片服务地址
server.seq++, (server.seq %= server.count);
return lang.replace(server[this.layerType], {
num: server.seq + server.start,
row: row,
col: col,
level: level,
});
},
});
});
// 自定义底图 (由TileLayer扩展)
// create by ysq 2019/5/8
define([
'gis/layers/TileLayer',
'dojo/_base/lang',
'gis/core/promiseUtils',
'./support/TilemetaUtils',
'gis/request',
], function (TileLayer, lang, promiseUtils, TilemetaUtils, request) {
var dpi = 96, //pixel per inch
level = 99, //地图缩放级数
levelStart = 0, // 起始级数
maxlevel = 20, //地图总级数
resolution_0 = 156543.033880145821696, //第0级分辨率 米/像素 156543.033880145821696
tileSize = 256, //瓦片大小
format = 'PNG', //图片格式
wkid = 4526, //102113
fullExtent = [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892], //[-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892]
origin = {
x: -20037508.3427892,
y: 20037508.3427892,
}, //裁图原点
server = {
//出图服务参数
count: 4, //服务总数
start: 0, //服务起始编号
seq: 0, //当前请求编号
//自定义
'google-user':
window.location.protocol +
'//{url}/gwc/service/wmts?layer={baseLayer}&style=&tilematrixset={tileMatrix}&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix={tileMatrix}%3A{level}&TileCol={col}&TileRow={row}',
};
return TileLayer.createSubclass([], {
declaredClass: 'gis.layers.UserTileLayer',
_fetchService: function () {
//重写 获取元数据,直接读取本地TileMetaData
return promiseUtils.resolve().then(
function () {
if (this.extent !== '' && this.extent.split(',').length == 4)
fullExtent = [
parseFloat(this.extent.split(',')[0]),
parseFloat(this.extent.split(',')[1]),
parseFloat(this.extent.split(',')[2]),
parseFloat(this.extent.split(',')[3]),
];
if (this.levelStart !== '' && parseFloat(this.levelStart))
levelStart = parseFloat(this.levelStart);
if (this.levelEnd && this.levelEnd == this.levelStart) {
level = parseInt(this.levelStart) + 1;
if (_config.client != 'sandbox')
mapManager.view.on('drag', (e) => {
e.stopPropagation();
});
} else if (this.levelEnd) {
level = parseInt(this.levelEnd) + 1;
} else {
}
if (this.resolution !== '' && parseFloat(this.resolution))
resolution_0 = parseFloat(this.resolution);
if (this.origin !== '' && this.origin.split(',').length == 2)
origin = {
x: parseFloat(this.origin.split(',')[0]),
y: parseFloat(this.origin.split(',')[1]),
};
this.read(
TilemetaUtils.getTilemeta(
resolution_0,
dpi,
level,
levelStart,
wkid,
fullExtent,
origin,
tileSize,
format,
),
);
}.bind(this),
);
},
getTileUrl: function (level, row, col) {
//重写 获取瓦片服务地址
server.seq++, (server.seq %= server.count);
return lang.replace(server[this.layerType], {
num: server.seq + server.start,
row: row,
col: col,
level: level,
url: this.url,
baseLayer: this.baseLayer,
scale:
window.devicePixelRatio > 1
? window.devicePixelRatio
: Math.ceil(window.devicePixelRatio),
tileMatrix: this.tileMatrix ? this.tileMatrix : 'EPSG:900913',
});
},
});
});
// create by ysq 2018/11/7
define([
'gis/layers/TileLayer',
'dojo/_base/lang',
'gis/core/promiseUtils',
'./support/TilemetaUtils',
], function (TileLayer, lang, promiseUtils, TilemetaUtils) {
var dpi = 96, //pixel per inch
level = 19, //地图总级数
levelStart = 9, // 起始级数
resolution_0 = 156543.03390625, //第0级分辨率 米/像素
tileSize = 256, //瓦片大小
format = 'PNG', //图片格式
wkid = 4526, //102113
fullExtent = [705289.3147226945, 206299.30564637203, 19490490.956488788, 8865103.18739793], //
origin = { x: -20037508.3427892, y: 20037508.3427892 }, //裁图原点
server =
'{ip}/gwc/rest/wmts/{name}/EPSG%3A900913/EPSG%3A900913%3A{level}/{row}/{col}?format=image/vnd.jpeg-png&type=map';
return TileLayer.createSubclass([], {
declaredClass: 'gis.layers.WMTSTileLayer',
_fetchService: function () {
//重写 获取元数据,读取本地TileMetaData
return promiseUtils.resolve().then(
function () {
this.read(
TilemetaUtils.getTilemeta(
resolution_0,
dpi,
level,
levelStart,
wkid,
fullExtent,
origin,
tileSize,
format,
),
);
}.bind(this),
);
},
getTileUrl: function (level, row, col) {
//重写 获取瓦片服务地址
return lang.replace(server, {
ip: this.url,
name: this.title,
row: row,
col: col,
level: level,
scale: 1,
});
},
});
});
import gisConfig from '../../config/gis';
const modules = [
'gis/layers/TileLayer',
'dojo/_base/lang',
'gis/core/promiseUtils',
'./support/TilemetaUtils',
];
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment