云查询图片叠加到地图里bug修正

dianlixunjian
滕嵩 2024-10-09 10:29:26 +08:00
parent 63bc7eefbb
commit 101e97d189
5 changed files with 19 additions and 33 deletions

View File

@ -166,25 +166,12 @@
};
//
const preloadImage = (url: string): Promise<string> => {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => {
resolve(url);
};
img.onerror = (error) => {
reject(error);
};
img.src = url;
});
};
const addOnMapChange = (value) => {
setTimeout(async () => {
let url = '';
let fourpoint = '';
if (value) {
let data = {};
let data: any = {};
if (activeKey.value == '1') {
props.data.forEach((item) => {
if (item.name == '土地分类') {
@ -208,7 +195,6 @@
image.crossOrigin = 'anonymous';
image.src = url;
image.onload = () => {
console.log(205, image);
// Canvas
const canvas = document.createElement('canvas');
canvas.width = image.width;
@ -220,7 +206,6 @@
ctx.drawImage(image, 0, 0, image.width, image.height);
// CanvasURL
const dataURL = canvas.toDataURL('image/jpeg');
console.log(216, dataURL);
//
if (map.getSource('radar')) {
@ -228,25 +213,27 @@
map.removeLayer('radar-layer');
}
if(fourpoint[2][0] == fourpoint[3][0]){
fourpoint[3][0] = fourpoint[0][0];
}
//
map.addSource('radar', {
type: 'image',
url: dataURL,
coordinates: fourpoint,
// coordinates: [
// [118.79657110932101, 35.1014168593995],
// [118.79971349626699, 35.1014168593995],
// [118.79971349626699, 35.0976945740112],
// [118.79371349626699, 35.0976945740112],
// ],
paint: {
'raster-opacity': 0,
},
});
// console.log(fourpoint);
map.addLayer({
id: 'radar-layer',
type: 'raster',
source: 'radar',
paint: {
'raster-fade-duration': 0,
'raster-opacity': 0.5,
},
});
@ -260,6 +247,7 @@
x = x / length;
y = y / length;
map.flyTo({
// center: [118.79657110932101, 35.1014168593995],
center: [fourpoint[0][0], fourpoint[0][1]],
zoom: 14,
});

View File

@ -37,7 +37,7 @@
const [registerTable] = useTable({
api: CaseOffenceMinerals,
columns: columns,
title: '无人机全域巡查图斑情况统计表',
// title: '',
// titleHelpMessage: '',
formConfig: {
labelWidth: 120,

View File

@ -262,8 +262,8 @@
const [registerTable] = useTable({
api: getCaseOffence,
columns: columns,
title: '无人机全域巡查图斑情况统计表',
titleHelpMessage: '合法、其他、非粮化、补办手续、拆除复耕均需市级审核通过才可判定为举证类型。',
// title: '',
// titleHelpMessage: '',
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,

View File

@ -260,8 +260,8 @@
const [registerTable] = useTable({
api: getCaseOffence,
columns: columns,
title: '无人机全域巡查图斑情况统计表',
titleHelpMessage: '合法、其他、非粮化、补办手续、拆除复耕均需市级审核通过才可判定为举证类型。',
// title: '',
// titleHelpMessage: '',
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,

View File

@ -281,7 +281,6 @@
.catch((error) => {
options.onError(error);
});
console.log(uploadFrom.value);
}
};
// 1-
@ -304,7 +303,6 @@
const sldContent = e.target.result;
const styles = parseSLD(sldContent);
assemblyPaint(styles);
// uploadFrom.value.style = styles;
};
reader.onerror = (error) => {
console.error('Error reading the file:', error);
@ -318,9 +316,9 @@
const namedLayers = xmlDoc.querySelectorAll('NamedLayer');
const styles: any = [];
namedLayers.forEach((namedLayer) => {
namedLayers?.forEach((namedLayer) => {
const userStyles = namedLayer.querySelectorAll('UserStyle');
userStyles.forEach((userStyle) => {
userStyles?.forEach((userStyle) => {
userStyle.children?.forEach((element) => {
if (element && element.nodeName == 'se:FeatureTypeStyle') {
element.children.forEach((featureTypeStyle) => {
@ -428,7 +426,7 @@
// style
uploadFrom.value.style = JSON.stringify(result);
console.log(uploadFrom.value.style);
// console.log(uploadFrom.value.style);
};
defineExpose({