跳到主要内容

flywave-mapview.mapviewutils.raycastgeocoordinates

Home > @flywave/flywave-mapview > MapViewUtils > rayCastGeoCoordinates

MapViewUtils.rayCastGeoCoordinates() function

Casts a ray in NDC space from the current view of the camera and returns the intersection point of that ray against the map in geo coordinates. The return value can be null when the raycast is above the horizon.

Signature:

function rayCastGeoCoordinates(mapView: MapView, pointOnScreenXinNDC: number, pointOnScreenYinNDC: number): GeoCoordinates | null;

Parameters

Parameter

Type

Description

mapView

MapView

Instance of MapView.

pointOnScreenXinNDC

number

pointOnScreenYinNDC

number

Returns:



GeoCoordinates \| null

Intersection geo coordinates, or `null` if raycast is above the horizon.