Getting height at a certain point of an uneven entity underground

Hi Community,

I have a very specific problem.

I want to make a longitudinal cut of the ground, including underground layers (currently just added via polygon entities).
Making the cut of the terrain itself is no problem, using sampleTerrainMostDetailed and just sample every 5 meters along that line. However I am having trouble of checking the height of the layers beneath along that same line. As those layers won’t be even, I can’t just drillpick and use the height of the drilled entity.

Is there a way to compute the height of a polygon (that has varying heights per position) for a certain position? Alternatively I thought maybe I can add a mantle below and use clampToHeightmostdetailed if I can somehow ignore the terrain when doing that?

Any help would be much appreciated.


Hi Jacques,

I think scene.sampleHeight is the best way to sample non-terrain primitives at the moment. While you can pass a list of primitives to ignore, I don’t think passing in terrain is supported in any way. You could try hiding terrain by setting the globe show property to false, calling sampleHeight and then setting show back to true.

I do see this as a valid use case, especially as we’ve added more supported features relating to underground and subsurface.

Hi Gabby,

Thank you for your answer.
I’m a bit unsure what the final data for the underground layers will look like, but I will try the hide/show workaround of the terrain when I get around to it and report back when I know if it worked or not. Thanks!

Hi again Gabby,

I’ve had some time to test the work around and it seems to be feasible for now. I was able to get the height of a model entity underground by turning the globe off before sampling and turning it back on afterwards. I have not tried yet with my longitudinal cut function, which should work as well but will probably cause a bit of a bad user experience when the globe is turned off over a prolonged time during the sampling.