同一个kmz数据同样的底图在QGIS上显示位置正常, 在Mars3d中显示就偏移了一些

问题:

1.同一个kmz数据同样的底图在QGIS上显示位置正常, 在网页中显示就偏移了一些

在qgis上的显示效果,和在mars3d的显示效果:数据明显存在偏移。

解决步骤:

1.查看了kmz数据,里面实际是tif图片数据,估计投影坐标有偏移造成的,tif用标准的4326或3857坐标系尝试

重新生成了数据为4326的,但在示例中测试后还是有偏移。

示例的测试地址:功能示例(Vue版) | Mars3D三维可视化平台 | 火星科技

function onMounted(mapInstance) {

mapInstance.setLayersOptions([{

name: 'HN',

type: 'kml',

// url:'https://1111111111111com/file/demo-data/HNS4326.kmz',

url:'https://com/file/demo-data/HNS_3857.kmz',

center: {"lat":19.9,"lng":110.5,"alt":136098,"heading":0,"pitch":-90},

show: true,

flyTo: true

}])

}

3.最后定位到问题是,cesium内部解析的,无法干预,最好是直接替换数据为3857坐标系尝试渲染。

备注说明:1.该示例cesium内部是用RectangleEntity+图片材质,实现的

2.建议直接用ImageLayer来加载这个tif图片。

3.Mars3d关于ImageLayer的使用示例参考与api地址:

功能示例(Vue版) | Mars3D三维可视化平台 | 火星科技

ImageLayer - V3.6.15 - Mars3D API文档

function createGroundOverlay(state, rectangleGraphics, overlays) {

const kmlDoc = state.kmlDoc;

const valueGetter = state.valueGetter;

const externalFileHandler = state.externalFileHandler;

const groundOverlay = kmlDoc.createElement("GroundOverlay");

// Set altitude mode

const altitudeMode = kmlDoc.createElement("altitudeMode");

altitudeMode.appendChild(

getAltitudeMode(state, rectangleGraphics.heightReference)

);

groundOverlay.appendChild(altitudeMode);

const height = valueGetter.get(rectangleGraphics.height);

if (defined(height)) {

groundOverlay.appendChild(

createBasicElementWithText(kmlDoc, "altitude", height)

);

}

const rectangle = valueGetter.get(rectangleGraphics.coordinates);

const latLonBox = kmlDoc.createElement("LatLonBox");

latLonBox.appendChild(

createBasicElementWithText(

kmlDoc,

"north",

CesiumMath.toDegrees(rectangle.north)

)

);

latLonBox.appendChild(

createBasicElementWithText(

kmlDoc,

"south",

CesiumMath.toDegrees(rectangle.south)

)

);

latLonBox.appendChild(

createBasicElementWithText(

kmlDoc,

"east",

CesiumMath.toDegrees(rectangle.east)

)

);

latLonBox.appendChild(

createBasicElementWithText(

kmlDoc,

"west",

CesiumMath.toDegrees(rectangle.west)

)

);

groundOverlay.appendChild(latLonBox);

// We should only end up here if we have an ImageMaterialProperty

const material = valueGetter.get(rectangleGraphics.material);

const href = externalFileHandler.texture(material.image);

const icon = kmlDoc.createElement("Icon");

icon.appendChild(createBasicElementWithText(kmlDoc, "href", href));

groundOverlay.appendChild(icon);

const color = material.color;

if (defined(color)) {

groundOverlay.appendChild(

createBasicElementWithText(kmlDoc, "color", colorToString(material.color))

);

}

overlays.push(groundOverlay);

}

相关推荐
陈随易8 分钟前
副业搞钱点子之独立开发
前端·后端·程序员
console.log('npc')17 分钟前
问题跟踪与知识沉淀:从任务到知识的闭环)
前端·javascript·人工智能
恋猫de小郭36 分钟前
最近 Android 有什么更新:Android Dev Summit 2026 技术解读
android·前端·flutter
计算机魔术师37 分钟前
Reddit 宣布转向以登录为主的体验,以应对 AI 搜索带来的流量下滑
前端
熊猫钓鱼>_>38 分钟前
上架审核常见驳回与隐私合规清单:过审前先自查这 8 条【鸿蒙心迹】
开发语言·前端·华为·华为云·harmonyos·openharmony·ai制作
missile11139 分钟前
# HDR 算法 ISP 通路客制化方案(G100 / mt6789)
java·前端·javascript
全栈陈序员1 小时前
【Python】基础语法入门(三十)—— Web 开发入门:用 Flask 搭建第一个网站
前端·python·flask
万少1 小时前
Harmony 7.0 这个skill帮你自动化操作AGC
前端·javascript·后端
小大宇1 小时前
Vue知识点-ElementPlus-02图标
前端·javascript·vue.js
简简单单就是我_hehe1 小时前
一次 ClickHouse 服务器磁盘告警的排查与修复实录
java·服务器·前端