1、问题详情:用S3MInstanceCollection加载空间分析返回的三维可视域闭合体时,报错。如下图:
2、具体步骤:
(1)参考示例:https://www.jianshu.com/p/a1ad75c70be8,请求得到三维可视域闭合体结果
$.ajax({
type: "get",
url: 'http://10.10.24.54:8090/iserver/services/spatialAnalysis-szzhz/restjsr/spatialanalyst/geometry/3d/viewshedbody/52918ad42db8418d9399c2ea76f0d2e3_2744895c37df4deb863a53b8095be199.rjson',
success: getSuccess
})
(2)绘制可视域几何体
function getSuccess(result) {
debugger;
var resultObj = JSON.parse(result);
var geometry = resultObj.geometry
if (!geometry) {
return;
}
var buffer = new Uint8Array(geometry.model).buffer;
var position = geometry.position;
var color = new Cesium.Color(0, 1, 0, 0.5);
var instanceColc = new Cesium.S3MInstanceCollection({
webgl : {
alpha : false,
depth : true,
stencil : false,
antialias : true,
premultipliedAlpha : true,
preserveDrawingBuffer : false,
failIfMajorPerformanceCaveat : true
},
allowTextureFilterAnisotropic : true
});
instanceColc.add('visibleBody', {
position: Cesium.Cartesian3.fromDegrees(position.x, position.y, position.z),
color: color
}, buffer);
if(resultObj) {
alert('可视域体积:'+resultObj.infos[0].volume)
}
}