Sample height returns undefined for longitude and latitude

Hello Team,
I have been facing issue with sampleHeight API.
I am using the sampleHeight API to get the height on the globe, but somehow it is returning the undefined for the particular location.

I have created the sandcastle for this particular issue.
Let me know if there is anything I can do to get the correct height for these values.
sandcastel link
Thank you.

Hi @MUKUND_THAKARE,

the problem is, that the code is executed faster than the rendering process. So the height gets sampled, when there is no globe rendered and it gets sampled as “undefined” acordingly.

You either have to set a timeout (like in this sandcastle), or bind the sampling on something like a user input. Sadly, there is no “scene ready event” for now.

Best, Lennart

EDIT: if you want a reasonable height, try some terrainProvider like in this sandcastle