Calculating Highest point over a model for position on ground

Hi all - what a great tool!

I’m loading a gltf (non symmetric) on the ground level. I need to calculate the heights over the model. (without user clicks)

Im currently doing it by: (midPoint - some point over the model - but we don’t know if it the highest point)

*var result=new Cesium.Cartesian2(0,0); *

*Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, midPoint,result); // simulating user click - getting the x, y on sceen *

*var midCartesian = scene.pickPosition(result); // *

var midCcartographic = Cesium.Cartographic.fromCartesian(midCartesian);

var h = midCcartographic.height

I have a feeling this is not optimal cause if the camera is not orthogonal I’m not sure the wgs84ToWindowCoordinates gives the right result.

What is the best way to “scan” an area (for exapmple - random points over user defined polygon) and get the max height (including entities and specially models )of each point ?



This is possible with terrain, but not really for models or entities.

Kind of like you mentioned, the only way is to do multiple pickPosition calls with an orthographic view. But even then you would need a lot of those calls to get an accurate result. It’s possible an optimized version of this could be built in to Cesium, but I doubt it would be soon.

If you can live with a less accurate number you can maybe use the model’s boundingSphere. Unfortunately I don’t think there’s a good solution here.