Mars3d加载矢量数据控制台提示addGraphic:数据id存在冲突,已重新赋值id
问题场景说明:
使用new mars3d.layer.GeoJsonLayer({加载geojson矢量文件的时候,发现控制台提示
graphicLayer = new mars3d.layer.GeoJsonLayer({name: "全国省界",url: "config/boom.json",symbol: {type: "polylineP",
[mars3d-sdk警告]: addGraphic:数据id存在冲突,已重新赋值id
解决方案:
1.根据控制台提示找到了原有id数据,搜索了原json文件
2.1发现是 "id": 685,与 "FID": 685,重复,导致的冲突问题,修改了原文件内数据,一切正常了。
2.2type换成polylineC大数据类型后 ,也可以避免报错警告
graphicLayer = new mars3d.layer.GeoJsonLayer({name: "全国省界",url: "config/boom.json",symbol: {type: "polylineP",styleOptions: {width: 2,materialType: mars3d.MaterialType.LineFlow,materialOptions: {color: "#00ffff",image: "https://data.mars3d.cn/img/textures/fence-line.png",speed: 10,repeat_x: 10},label: {text: "{Name}",font_size: 30,color: "#ffffff"}}},flyTo: true})map.addLayer(graphicLayer)
解释说明:
1.加载矢量图层时, id跟FID,最好不要重复,否则会产生冲突警告
2.polylineC合并渲染了,查询不到下一层的graphic,所以不会产生冲突警告