feature: 新增地形图
This commit is contained in:
parent
d62777bc91
commit
16c659a42d
@ -231,6 +231,8 @@
|
|||||||
<select id="mapTypeSelect" lay-filter="mapType">
|
<select id="mapTypeSelect" lay-filter="mapType">
|
||||||
<option value="tianditu_satellite" selected>天地图-卫星影像</option>
|
<option value="tianditu_satellite" selected>天地图-卫星影像</option>
|
||||||
<option value="tianditu_normal">天地图-矢量</option>
|
<option value="tianditu_normal">天地图-矢量</option>
|
||||||
|
<option value="tianditu_terrain">天地图-地形</option>
|
||||||
|
<option value="tianditu_terrain_hybrid">天地图-地形混合</option>
|
||||||
<option value="amap_satellite">高德-卫星影像</option>
|
<option value="amap_satellite">高德-卫星影像</option>
|
||||||
<option value="amap">高德-矢量</option>
|
<option value="amap">高德-矢量</option>
|
||||||
</select>
|
</select>
|
||||||
@ -371,15 +373,10 @@
|
|||||||
imageTile.getImage().onerror = function() {
|
imageTile.getImage().onerror = function() {
|
||||||
// 天地图加载失败时切换到高德地图
|
// 天地图加载失败时切换到高德地图
|
||||||
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
||||||
if(mapTypeSelect.value === 'tianditu_satellite') {
|
if(mapTypeSelect.value.startsWith('tianditu_')) {
|
||||||
mapTypeSelect.value = 'amap_satellite';
|
|
||||||
switchMapType('amap_satellite');
|
|
||||||
layer.msg('天地图卫星图加载失败,已自动切换到高德卫星图');
|
|
||||||
layui.form.render('select');
|
|
||||||
} else if(mapTypeSelect.value === 'tianditu_normal') {
|
|
||||||
mapTypeSelect.value = 'amap';
|
mapTypeSelect.value = 'amap';
|
||||||
switchMapType('amap');
|
switchMapType('amap');
|
||||||
layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图');
|
layer.msg('天地图加载失败,已自动切换到高德地图');
|
||||||
layui.form.render('select');
|
layui.form.render('select');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -394,15 +391,10 @@
|
|||||||
imageTile.getImage().onerror = function() {
|
imageTile.getImage().onerror = function() {
|
||||||
// 天地图加载失败时切换到高德地图
|
// 天地图加载失败时切换到高德地图
|
||||||
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
||||||
if(mapTypeSelect.value === 'tianditu_satellite') {
|
if(mapTypeSelect.value.startsWith('tianditu_')) {
|
||||||
mapTypeSelect.value = 'amap_satellite';
|
|
||||||
switchMapType('amap_satellite');
|
|
||||||
layer.msg('天地图卫星图加载失败,已自动切换到高德卫星图');
|
|
||||||
layui.form.render('select');
|
|
||||||
} else if(mapTypeSelect.value === 'tianditu_normal') {
|
|
||||||
mapTypeSelect.value = 'amap';
|
mapTypeSelect.value = 'amap';
|
||||||
switchMapType('amap');
|
switchMapType('amap');
|
||||||
layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图');
|
layer.msg('天地图加载失败,已自动切换到高德地图');
|
||||||
layui.form.render('select');
|
layui.form.render('select');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -421,15 +413,10 @@
|
|||||||
imageTile.getImage().onerror = function() {
|
imageTile.getImage().onerror = function() {
|
||||||
// 天地图加载失败时切换到高德地图
|
// 天地图加载失败时切换到高德地图
|
||||||
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
||||||
if(mapTypeSelect.value === 'tianditu_satellite') {
|
if(mapTypeSelect.value.startsWith('tianditu_')) {
|
||||||
mapTypeSelect.value = 'amap_satellite';
|
|
||||||
switchMapType('amap_satellite');
|
|
||||||
layer.msg('天地图卫星图加载失败,已自动切换到高德卫星图');
|
|
||||||
layui.form.render('select');
|
|
||||||
} else if(mapTypeSelect.value === 'tianditu_normal') {
|
|
||||||
mapTypeSelect.value = 'amap';
|
mapTypeSelect.value = 'amap';
|
||||||
switchMapType('amap');
|
switchMapType('amap');
|
||||||
layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图');
|
layer.msg('天地图加载失败,已自动切换到高德地图');
|
||||||
layui.form.render('select');
|
layui.form.render('select');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -444,12 +431,29 @@
|
|||||||
imageTile.getImage().onerror = function() {
|
imageTile.getImage().onerror = function() {
|
||||||
// 天地图加载失败时切换到高德地图
|
// 天地图加载失败时切换到高德地图
|
||||||
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
||||||
if(mapTypeSelect.value === 'tianditu_satellite') {
|
if(mapTypeSelect.value.startsWith('tianditu_')) {
|
||||||
mapTypeSelect.value = 'amap_satellite';
|
mapTypeSelect.value = 'amap';
|
||||||
switchMapType('amap_satellite');
|
switchMapType('amap');
|
||||||
layer.msg('天地图卫星图加载失败,已自动切换到高德卫星图');
|
layer.msg('天地图加载失败,已自动切换到高德地图');
|
||||||
layui.form.render('select');
|
layui.form.render('select');
|
||||||
} else if(mapTypeSelect.value === 'tianditu_normal') {
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
tianditu_terrain: new ol.layer.Group({
|
||||||
|
layers: [
|
||||||
|
new ol.layer.Tile({
|
||||||
|
source: new ol.source.XYZ({
|
||||||
|
url: 'https://t{0-7}.tianditu.gov.cn/ter_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ter&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=' + TIANDITU_KEY,
|
||||||
|
tileLoadFunction: function(imageTile, src) {
|
||||||
|
imageTile.getImage().src = src;
|
||||||
|
imageTile.getImage().onerror = function() {
|
||||||
|
// 天地图加载失败时切换到高德地图
|
||||||
|
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
||||||
|
if(mapTypeSelect.value.startsWith('tianditu_')) {
|
||||||
mapTypeSelect.value = 'amap';
|
mapTypeSelect.value = 'amap';
|
||||||
switchMapType('amap');
|
switchMapType('amap');
|
||||||
layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图');
|
layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图');
|
||||||
@ -460,6 +464,46 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
}),
|
||||||
|
tianditu_terrain_hybrid: new ol.layer.Group({
|
||||||
|
layers: [
|
||||||
|
new ol.layer.Tile({
|
||||||
|
source: new ol.source.XYZ({
|
||||||
|
url: 'https://t{0-7}.tianditu.gov.cn/ter_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ter&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=' + TIANDITU_KEY,
|
||||||
|
tileLoadFunction: function(imageTile, src) {
|
||||||
|
imageTile.getImage().src = src;
|
||||||
|
imageTile.getImage().onerror = function() {
|
||||||
|
// 天地图加载失败时切换到高德地图
|
||||||
|
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
||||||
|
if(mapTypeSelect.value.startsWith('tianditu_')) {
|
||||||
|
mapTypeSelect.value = 'amap';
|
||||||
|
switchMapType('amap');
|
||||||
|
layer.msg('天地图加载失败,已自动切换到高德地图');
|
||||||
|
layui.form.render('select');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
new ol.layer.Tile({
|
||||||
|
source: new ol.source.XYZ({
|
||||||
|
url: 'https://t{0-7}.tianditu.gov.cn/cta_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cta&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=' + TIANDITU_KEY,
|
||||||
|
tileLoadFunction: function(imageTile, src) {
|
||||||
|
imageTile.getImage().src = src;
|
||||||
|
imageTile.getImage().onerror = function() {
|
||||||
|
// 天地图加载失败时切换到高德地图
|
||||||
|
var mapTypeSelect = document.getElementById('mapTypeSelect');
|
||||||
|
if(mapTypeSelect.value.startsWith('tianditu_')) {
|
||||||
|
mapTypeSelect.value = 'amap';
|
||||||
|
switchMapType('amap');
|
||||||
|
layer.msg('天地图加载失败,已自动切换到高德地图');
|
||||||
|
layui.form.render('select');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
]
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user