您的位置:首页 > 游戏 > 游戏 > geojson文件默认已有的style会导致webGL渲染错误处理办法

geojson文件默认已有的style会导致webGL渲染错误处理办法

2025/2/26 2:27:37 来源:https://blog.csdn.net/m0_69803146/article/details/139865332  浏览:    关键词:geojson文件默认已有的style会导致webGL渲染错误处理办法

geojson文件默认已有的style会导致webGL渲染错误处理办法

相关链接:

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

代码:

export function showDraw(isFlyTo) {removeLayer()graphicLayer = new mars3d.layer.GeoJsonLayer({data: {type: "FeatureCollection",features: [{type: "Feature",geometry: {type: "Point",coordinates: [121.453893, 29.888391],},properties: {gid: "1",code: "1718850737365",type: 'circleP',style: {radius: 1693.63}},id: "fid--45368680_1902ac1ce0f_-7fde",},],},symbol: {styleOptions: {color: "#FF0000",},},flyTo: true});map.addLayer(graphicLayer);
}

效果:

报错:

Cesium.js:15236 An error occurred while rendering.  Rendering has stopped.
DeveloperError: normalized result is not a number
Error

处理办法:

设置下 merge为true即可,

正确代码:

export function showDraw(isFlyTo) {removeLayer()graphicLayer = new mars3d.layer.GeoJsonLayer({data: {type: "FeatureCollection",features: [{type: "Feature",geometry: {type: "Point",coordinates: [121.453893, 29.888391],},properties: {gid: "1",code: "1718850737365",type: 'circleP',style: {radius: 1693.63}},id: "fid--45368680_1902ac1ce0f_-7fde",},],},symbol: {merge: true,styleOptions: {color: "#FF0000",},},flyTo: true});map.addLayer(graphicLayer);
}

正常效果:

原因:

1.内置的style与symbol配置冲突,需要合并并覆盖json中已有的style

相关api:

Mars3D三维可视化平台 | 火星科技

 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com