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

Hi,

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: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Picking.html&label=Showcases

Create a ray from your current camera position to the 3d point of interest, then use pick http://cesiumjs.org/Cesium/Build/Documentation/Globe.html?classFilter=globe#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!

Kohei

Hi Kohei,

The point to point visibility issue is a little more complicated than I described, so here’s a code example: http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=822f432f2955dc9d57dee6d42f3632a6

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

  • Rachel