map

map.screenToLatLng

screenToLatLng(screenX: number, screenY: number): GeoPosition

Convert screen pixel coordinates to a geographic position.

Steps (planar):

  1. Convert pixel → NDC.
  2. Unproject a ray from the camera.
  3. Intersect the ray with the map plane (z=0 in cloudScene local space).
  4. Apply inverse cloudScene transform to get cloudScene-local coords.
  5. Convert to lat/lng via worldToLatLng.

Steps (spherical): 1-2 as above. 3. Intersect the ray with the globe sphere (radius = EARTH_RADIUS, scale=1). 4-5 as above.

Returns null when map is disabled, scene/camera are not wired, or the ray misses the map surface.

screenXnumber
screenYnumber

Returns: GeoPosition