同一个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);

}

相关推荐
Escalating_xu6 分钟前
【C++类和对象(上)】从类的定义、封装与对象模型到内存对齐和 this 指针
开发语言·前端·c++
Json____8 分钟前
宿舍安全卫生检查系统:Node 全栈开发实战
java·前端·数据库·毕业设计·课程设计·毕设·wwwoop.com
晴天1613 分钟前
HTML canvas标签使用指南-Day32
前端·html
weixin1997010801616 分钟前
《alibaba.idle.isv.order.ship 接入实录:闲鱼订单发货回传的5个隐式约束》(附Python源码)
服务器·前端·python
初願致夕霞24 分钟前
五种IO模型(详解非阻塞IO与多路转接)
linux·前端·网络·数据库·tcp/ip
深圳多奥智能一卡(码、脸)通系统26 分钟前
智能梯控SDK可直接用于第三方开发对接的接口文档说明书
服务器·前端·算法
烂蜻蜓35 分钟前
Flask入门教程(十五):错误处理与日志——打造健壮的Web应用
前端·python·flask
深念Y42 分钟前
浏览器缩放检测的前端通用方案
前端
风骏时光牛马1 小时前
AIAgent异常故障根因分析与复盘总结
前端
weixin_431600441 小时前
前端数据埋点(7):Web Vitals——页面慢不慢,不是再包一层 fetch
前端·性能优化·sentry·数据埋点