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

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,14 +64,9 @@
} }
const initMap = () => { const initMap = () => {
return new mapboxgl.Map({ let mapDataSources: any =
container: mapId, networkType.value == 'LAN'
language: 'zh-cmn', ? {
projection: 'equirectangular', // wgs84
style: {
glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf',
version: 8,
sources: {
'raster-tiles': { 'raster-tiles': {
type: 'raster', type: 'raster',
tiles: [ tiles: [
@ -102,27 +97,43 @@
minzoom: 16, minzoom: 16,
maxzoom: 24, 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,
}, },
layers: [ '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', id: 'tdt-vec-tiles',
type: 'raster', type: 'raster',
source: 'raster-tiles-font', source: 'raster-tiles-font',
maxZoom: 32,
}, },
{ {
id: 'tdt-img-tiles', id: 'tdt-img-tiles',
type: 'raster', type: 'raster',
source: 'raster-tiles', source: 'raster-tiles',
maxZoom: 32,
}, },
{ {
id: 'yaogan', id: 'yaogan',
type: 'raster', type: 'raster',
source: 'yaogan', source: 'yaogan',
layout: {
visibility: networkType.value == 'LAN' ? 'visible' : 'none',
},
minzoom: 9, minzoom: 9,
maxzoom: 15, maxzoom: 15,
}, },
@ -130,13 +141,32 @@
id: 'yingxiang', id: 'yingxiang',
type: 'raster', type: 'raster',
source: 'yingxiang', source: 'yingxiang',
layout: {
visibility: networkType.value == 'LAN' ? 'visible' : 'none',
},
minzoom: 13, minzoom: 13,
maxzoom: 24, 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',
projection: 'equirectangular', // wgs84
style: {
glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf',
version: 8,
sources: mapDataSources,
layers: mapDataLayers,
}, },
maxZoom: 22, maxZoom: 22,
minZoom: 8, minZoom: 8,

View File

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