正式环境云查询叠加图片问题修正

hefeichangfeng
滕嵩 2025-01-17 16:22:21 +08:00
parent f09900d426
commit fd441f2967
2 changed files with 97 additions and 70 deletions

View File

@ -64,6 +64,100 @@
}
const initMap = () => {
let mapDataSources: any =
networkType.value == 'LAN'
? {
'raster-tiles': {
type: 'raster',
tiles: [
`http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
],
tileSize: 256,
minzoom: 1,
maxzoom: 17,
},
'raster-tiles-font': {
type: 'raster',
tiles: [
`https://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
],
tileSize: 256,
},
yaogan: {
type: 'raster',
tiles: [VITE_GLOB_YAOGANYINGXIANG_SERVER],
tileSize: 256,
minzoom: 16,
maxzoom: 24,
},
yingxiang: {
type: 'raster',
tiles: [VITE_GLOB_YINGXIANG_SERVER],
tileSize: 256,
minzoom: 16,
maxzoom: 24,
},
}
: {
'raster-tiles': {
type: 'raster',
tiles: [
`http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
],
tileSize: 256,
minzoom: 1,
maxzoom: 17,
},
'raster-tiles-font': {
type: 'raster',
tiles: [
`https://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
],
tileSize: 256,
},
};
let mapDataLayers: any =
networkType.value == 'LAN'
? [
{
id: 'tdt-vec-tiles',
type: 'raster',
source: 'raster-tiles-font',
},
{
id: 'tdt-img-tiles',
type: 'raster',
source: 'raster-tiles',
},
{
id: 'yaogan',
type: 'raster',
source: 'yaogan',
minzoom: 9,
maxzoom: 15,
},
{
id: 'yingxiang',
type: 'raster',
source: 'yingxiang',
minzoom: 13,
maxzoom: 24,
},
]
: [
{
id: 'tdt-vec-tiles',
type: 'raster',
source: 'raster-tiles-font',
},
{
id: 'tdt-img-tiles',
type: 'raster',
source: 'raster-tiles',
},
];
return new mapboxgl.Map({
container: mapId,
language: 'zh-cmn',
@ -71,72 +165,8 @@
style: {
glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf',
version: 8,
sources: {
'raster-tiles': {
type: 'raster',
tiles: [
`http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
],
tileSize: 256,
minzoom: 1,
maxzoom: 17,
},
'raster-tiles-font': {
type: 'raster',
tiles: [
`https://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
],
tileSize: 256,
},
yaogan: {
type: 'raster',
tiles: [VITE_GLOB_YAOGANYINGXIANG_SERVER],
tileSize: 256,
minzoom: 16,
maxzoom: 24,
},
yingxiang: {
type: 'raster',
tiles: [VITE_GLOB_YINGXIANG_SERVER],
tileSize: 256,
minzoom: 16,
maxzoom: 24,
},
},
layers: [
{
id: 'tdt-vec-tiles',
type: 'raster',
source: 'raster-tiles-font',
maxZoom: 32,
},
{
id: 'tdt-img-tiles',
type: 'raster',
source: 'raster-tiles',
maxZoom: 32,
},
{
id: 'yaogan',
type: 'raster',
source: 'yaogan',
layout: {
visibility: networkType.value == 'LAN' ? 'visible' : 'none',
},
minzoom: 9,
maxzoom: 15,
},
{
id: 'yingxiang',
type: 'raster',
source: 'yingxiang',
layout: {
visibility: networkType.value == 'LAN' ? 'visible' : 'none',
},
minzoom: 13,
maxzoom: 24,
},
],
sources: mapDataSources,
layers: mapDataLayers,
},
maxZoom: 22,
minZoom: 8,

View File

@ -353,11 +353,8 @@
//
map.addSource('radar', {
type: 'image',
url: url,
url: dataURL,
coordinates: fourpoint,
paint: {
'raster-opacity': 1,
},
});
map.addLayer({
id: 'radar-layer',