Can I calculate forward/backward transformation from geolocation(lat/lon/height) to screen X,Y?


I want to know what geolocation point(lat/lon/height) is shown on the screen X,Y without user clicking event.
And also, want to know if each geolocation point is visible now or hidden behind the ridge.

Such calculation is possible?

Hi Ko-hei,

Yes! You can get the Cartesian3 (3D scene space position) from a given (x, y) pixel coordinates using Scene.pickPosition. Here’s some example code:

Create a ray from your current camera position to the 3d point of interest, then use pick (which takes a ray) to return the first entity along that ray. If pick gives you the expected entity, then it’s visible. Otherwise, if its a different entity or undefined, it’s occluded.

Hope that helps!

  • Rachel

Hi Rachel,

Great! I will try, thank you!


Hi Kohei,

The point to point visibility issue is a little more complicated than I described, so here’s a code example:

Let me know if you need any clarifications – hope that helps!

  • Rachel