Skip to main content

Class: GeoPoint

A point on Earth's surface. This class uses a spherical Earth model.

Implements

Constructors

constructor

new GeoPoint(lat, lon): GeoPoint

Constructor.

Parameters

NameTypeDescription
latnumberThe latitude, in degrees.
lonnumberThe longitude, in degrees.

Returns

GeoPoint

Defined in

src/sdk/geo/GeoPoint.ts:340

Properties

readonly

Readonly readonly: GeoPointReadOnly

Defined in

src/sdk/geo/GeoPoint.ts:333


EQUALITY_TOLERANCE

Static Readonly EQUALITY_TOLERANCE: 1e-7

The default equality tolerance, defined as the maximum allowed distance between two equal points in great-arc radians.

Defined in

src/sdk/geo/GeoPoint.ts:326

Accessors

lat

get lat(): number

The latitude of this point, in degrees.

Returns

number

the latitude of this point.

Implementation of

LatLonInterface.lat

Defined in

src/sdk/geo/GeoPoint.ts:349


lon

get lon(): number

The longitude of this point, in degrees.

Returns

number

the longitude of this point.

Implementation of

LatLonInterface.lon

Defined in

src/sdk/geo/GeoPoint.ts:357

Methods

antipode

antipode(out?): GeoPoint

Gets the antipode of this point.

Parameters

NameTypeDescription
out?GeoPointThe GeoPoint to which to write the results. By default this point.

Returns

GeoPoint

The antipode of this point.

Implementation of

GeoPointInterface.antipode

Defined in

src/sdk/geo/GeoPoint.ts:570


bearingFrom

bearingFrom(other): number

Calculates the final true bearing from another point to this point (i.e. the back azimuth from this point to the other point) along the great circle connecting the two.

Parameters

NameTypeDescription
otherLatLonInterfaceThe other point.

Returns

number

The final true bearing from the other point, in degrees.

Implementation of

GeoPointInterface.bearingFrom

Defined in

src/sdk/geo/GeoPoint.ts:486

bearingFrom(lat, lon): number

Calculates the final true bearing from another point to this point (i.e. the back azimuth from this point to the other point) along the great circle connecting the two.

Parameters

NameTypeDescription
latnumberThe latitude of the other point, in degrees.
lonnumberThe longitude of the other point, in degrees.

Returns

number

The final true bearing from the other point, in degrees.

Implementation of

GeoPointInterface.bearingFrom

Defined in

src/sdk/geo/GeoPoint.ts:488


bearingRhumb

bearingRhumb(other): number

Calculates the constant true bearing from this point to another point along the rhumb line connecting the two.

Parameters

NameTypeDescription
otherLatLonInterfaceThe other point.

Returns

number

The constant true bearing to the other point, in degrees.

Implementation of

GeoPointInterface.bearingRhumb

Defined in

src/sdk/geo/GeoPoint.ts:496

bearingRhumb(lat, lon): number

Calculates the constant true bearing from this point to another point along the rhumb line connecting the two.

Parameters

NameTypeDescription
latnumberThe latitude of the other point, in degrees.
lonnumberThe longitude of the other point, in degrees.

Returns

number

The constant true bearing to the other point, in degrees.

Implementation of

GeoPointInterface.bearingRhumb

Defined in

src/sdk/geo/GeoPoint.ts:498


bearingTo

bearingTo(other): number

Calculates the initial true bearing (forward azimuth) from this point to another point along the great circle connecting the two.

Parameters

NameTypeDescription
otherLatLonInterfaceThe other point.

Returns

number

The initial true bearing to the other point, in degrees.

Implementation of

GeoPointInterface.bearingTo

Defined in

src/sdk/geo/GeoPoint.ts:476

bearingTo(lat, lon): number

Calculates the initial true bearing (forward azimuth) from this point to another point along the great circle connecting the two.

Parameters

NameTypeDescription
latnumberThe latitude of the other point, in degrees.
lonnumberThe longitude of the other point, in degrees.

Returns

number

The initial true bearing to the other point, in degrees.

Implementation of

GeoPointInterface.bearingTo

Defined in

src/sdk/geo/GeoPoint.ts:478


copy

copy(to?): GeoPoint

Copies this point.

Parameters

NameTypeDescription
to?GeoPointAn optional point to which to copy this point. If this argument is not supplied, a new GeoPoint object will be created.

Returns

GeoPoint

A copy of this point.

Implementation of

GeoPointInterface.copy

Defined in

src/sdk/geo/GeoPoint.ts:600


distance

distance(other): number

Calculates the great-circle distance between this point and another point.

Parameters

NameTypeDescription
otherLatLonInterfaceThe point to which to calculate the distance.

Returns

number

The great-circle distance to the other point, in great-arc radians.

Implementation of

GeoPointInterface.distance

Defined in

src/sdk/geo/GeoPoint.ts:456

distance(lat, lon): number

Calculates the great-circle distance between this point and another point.

Parameters

NameTypeDescription
latnumberThe latitude of the point to which to calculate the distance.
lonnumberThe longitude of the point to which to calculate the distance.

Returns

number

The great-circle distance to the other point, in great-arc radians.

Implementation of

GeoPointInterface.distance

Defined in

src/sdk/geo/GeoPoint.ts:458


distanceRhumb

distanceRhumb(other): number

Calculates the distance along the rhumb line connecting this point with another point.

Parameters

NameTypeDescription
otherLatLonInterfaceThe other point.

Returns

number

The rhumb-line distance to the other point, in great-arc radians.

Implementation of

GeoPointInterface.distanceRhumb

Defined in

src/sdk/geo/GeoPoint.ts:466

distanceRhumb(lat, lon): number

Calculates the distance along the rhumb line connecting this point with another point.

Parameters

NameTypeDescription
latnumberThe latitude of the other point, in degrees.
lonnumberThe longitude of the other point, in degrees.

Returns

number

The rhumb-line distance to the other point, in great-arc radians.

Implementation of

GeoPointInterface.distanceRhumb

Defined in

src/sdk/geo/GeoPoint.ts:468


equals

equals(other, tolerance?): boolean

Checks whether this point is equal to another point. Two points are considered equal if and only if the great- circle distance between them is less than or equal to a specified tolerance or if the latitude and longitude components of both points are equal to NaN.

Parameters

NameTypeDescription
otherLatLonInterfaceThe other point.
tolerance?numberThe tolerance of the equality check, defined as the maximum allowed distance between two equal points in great-arc radians.

Returns

boolean

Whether this point is equal to the other point.

Implementation of

GeoPointInterface.equals

Defined in

src/sdk/geo/GeoPoint.ts:580

equals(lat, lon, tolerance?): boolean

Checks whether this point is equal to another point. Two points are considered equal if and only if the great- circle distance between them is less than or equal to a specified tolerance or if the latitude and longitude components of both points are equal to NaN.

Parameters

NameTypeDescription
latnumberThe latitude of the other point, in degrees.
lonnumberThe longitude of the other point, in degrees.
tolerance?numberThe tolerance of the equality check, defined as the maximum allowed distance between two equal points in great-arc radians.

Returns

boolean

Whether this point is equal to the other point.

Implementation of

GeoPointInterface.equals

Defined in

src/sdk/geo/GeoPoint.ts:582


offset

offset(bearing, distance, out?): GeoPoint

Offsets this point by an initial bearing and distance along a great circle.

Parameters

NameTypeDescription
bearingnumberThe initial true bearing (forward azimuth), in degrees, by which to offset.
distancenumberThe distance, in great-arc radians, by which to offset.
out?GeoPointThe GeoPoint to which to write the result. By default this point.

Returns

GeoPoint

The offset point.

Implementation of

GeoPointInterface.offset

Defined in

src/sdk/geo/GeoPoint.ts:512


offsetRhumb

offsetRhumb(bearing, distance, out?): GeoPoint

Offsets this point by a constant bearing and distance along a rhumb line.

Parameters

NameTypeDescription
bearingnumberThe true bearing, in degrees, by which to offset.
distancenumberThe distance, in great-arc radians, by which to offset.
out?GeoPointThe GeoPoint to which to write the result. By default this point.

Returns

GeoPoint

The offset point.

Implementation of

GeoPointInterface.offsetRhumb

Defined in

src/sdk/geo/GeoPoint.ts:539


set

set(other): this

Sets this point's latitude/longitude values.

Parameters

NameTypeDescription
otherLatLonInterfaceThe point from which to take the new latitude/longitude values.

Returns

this

This point, after it has been changed.

Defined in

src/sdk/geo/GeoPoint.ts:396

set(lat, lon): this

Sets this point's latitude/longitude values.

Parameters

NameTypeDescription
latnumberThe new latitude, in degrees.
lonnumberThe new longitude, in degrees.

Returns

this

This point, after it has been changed.

Defined in

src/sdk/geo/GeoPoint.ts:403


setFromCartesian

setFromCartesian(vec): this

Sets this point's coordinate values from a cartesian position vector. By convention, in the cartesian coordinate system the origin is at the center of the Earth, the positive x-axis passes through 0 degrees N, 0 degrees E, and the positive z-axis passes through the north pole.

Parameters

NameTypeDescription
vecReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>A position vector defining the new coordinates.

Returns

this

This point, after it has been changed.

Defined in

src/sdk/geo/GeoPoint.ts:435

setFromCartesian(x, y, z): this

Sets this point's coordinate values from a cartesian position vector. By convention, in the cartesian coordinate system the origin is at the center of the Earth, the positive x-axis passes through 0 degrees N, 0 degrees E, and the positive z-axis passes through the north pole.

Parameters

NameTypeDescription
xnumberThe x component of a position vector defining the new coordinates.
ynumberThe y component of a position vector defining the new coordinates.
znumberThe z component of a position vector defining the new coordinates.

Returns

this

This point, after it has been changed.

Defined in

src/sdk/geo/GeoPoint.ts:445


toCartesian

toCartesian(out): Float64Array

Calculates the cartesian (x, y, z) representation of this point, in units of great-arc radians. By convention, in the cartesian coordinate system the origin is at the center of the Earth, the positive x-axis passes through 0 degrees N, 0 degrees E, and the positive z-axis passes through the north pole.

Parameters

NameTypeDescription
outFloat64ArrayThe vector array to which to write the result.

Returns

Float64Array

The cartesian representation of this point.

Implementation of

GeoPointInterface.toCartesian

Defined in

src/sdk/geo/GeoPoint.ts:575


bearingRhumb

bearingRhumb(lat1, lon1, lat2, lon2): number

Calculates the constant true bearing from one point to another along the rhumb line connecting the two.

Parameters

NameTypeDescription
lat1numberThe latitude of the initial point, in degrees.
lon1numberThe longitude of the initial point, in degrees.
lat2numberThe latitude of the final point, in degrees.
lon2numberThe longitude of the final point, in degrees.

Returns

number

The constant true bearing, in degrees, from the initial point to the final point along the rhumb line connecting the two.

Defined in

src/sdk/geo/GeoPoint.ts:835


distance

distance(lat1, lon1, lat2, lon2): number

Calculates the great-circle distance between two points.

Parameters

NameTypeDescription
lat1numberThe latitude of the first point, in degrees.
lon1numberThe longitude of the first point, in degrees.
lat2numberThe latitude of the second point, in degrees.
lon2numberThe longitude of the second point, in degrees.

Returns

number

The great-circle distance between the two points, in great-arc radians.

Defined in

src/sdk/geo/GeoPoint.ts:685

distance(point1, point2): number

Calculates the great-circle distance between two points.

Parameters

NameTypeDescription
point1LatLonInterfaceThe first point.
point2LatLonInterfaceThe second point.

Returns

number

The great-circle distance between the two points, in great-arc radians.

Defined in

src/sdk/geo/GeoPoint.ts:692

distance(point1, point2): number

Calculates the great-circle distance between two points.

Parameters

NameTypeDescription
point1Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The first point, in cartesian form.
point2Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The second point, in cartesian form.

Returns

number

The great-circle distance between the two points, in great-arc radians.

Defined in

src/sdk/geo/GeoPoint.ts:699


distanceRhumb

distanceRhumb(lat1, lon1, lat2, lon2): number

Calculates the distance along the rhumb line connecting this point with another point.

Parameters

NameTypeDescription
lat1numberThe latitude of the first point, in degrees.
lon1numberThe longitude of the first point, in degrees.
lat2numberThe latitude of the second point, in degrees.
lon2numberThe longitude of the second point, in degrees.

Returns

number

The distance along the rhumb line connecting the two points, in great-arc radians.

Defined in

src/sdk/geo/GeoPoint.ts:740

distanceRhumb(point1, point2): number

Calculates the distance along the rhumb line connecting this point with another point.

Parameters

NameTypeDescription
point1LatLonInterfaceThe first point.
point2LatLonInterfaceThe second point.

Returns

number

The distance along the rhumb line connecting the two points, in great-arc radians.

Defined in

src/sdk/geo/GeoPoint.ts:747

distanceRhumb(point1, point2): number

Calculates the distance along the rhumb line connecting this point with another point.

Parameters

NameTypeDescription
point1Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The first point, in cartesian form.
point2Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The second point, in cartesian form.

Returns

number

The distance along the rhumb line connecting the two points, in great-arc radians.

Defined in

src/sdk/geo/GeoPoint.ts:754


equals

equals(lat1, lon1, lat2, lon2, tolerance?): boolean

Checks whether two points are equal.

Parameters

NameTypeDescription
lat1numberThe latitude of the first point, in degrees.
lon1numberThe longitude of the first point, in degrees.
lat2numberThe latitude of the second point, in degrees.
lon2numberThe longitude of the second point, in degrees.
tolerance?numberThe tolerance of the equality check, defined as the maximum allowed distance between two equal points in great-arc radians. Defaults to GeoPoint.EQUALITY_TOLERANCE.

Returns

boolean

Whether the two points are equal.

Defined in

src/sdk/geo/GeoPoint.ts:641

equals(point1, point2, tolerance?): boolean

Checks whether two points are equal.

Parameters

NameTypeDescription
point1LatLonInterfaceThe first point.
point2LatLonInterfaceThe second point.
tolerance?numberThe tolerance of the equality check, defined as the maximum allowed distance between two equal points in great-arc radians. Defaults to GeoPoint.EQUALITY_TOLERANCE.

Returns

boolean

Whether the two points are equal.

Defined in

src/sdk/geo/GeoPoint.ts:650

equals(point1, point2, tolerance?): boolean

Checks whether two points are equal.

Parameters

NameTypeDescription
point1Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The first point, in cartesian form.
point2Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The second point, in cartesian form.
tolerance?numberThe tolerance of the equality check, defined as the maximum allowed distance between two equal points in great-arc radians. Defaults to GeoPoint.EQUALITY_TOLERANCE.

Returns

boolean

Whether the two points are equal.

Defined in

src/sdk/geo/GeoPoint.ts:659


finalBearing

finalBearing(lat1, lon1, lat2, lon2): number

Calculates the final true bearing from one point to another along the great circle connecting the two.

Parameters

NameTypeDescription
lat1numberThe latitude of the initial point, in degrees.
lon1numberThe longitude of the initial point, in degrees.
lat2numberThe latitude of the final point, in degrees.
lon2numberThe longitude of the final point, in degrees.

Returns

number

The final true bearing, in degrees, from the initial point to the final point along the great circle connecting the two.

Defined in

src/sdk/geo/GeoPoint.ts:822


initialBearing

initialBearing(lat1, lon1, lat2, lon2): number

Calculates the initial true bearing (forward azimuth) from one point to another along the great circle connecting the two.

Parameters

NameTypeDescription
lat1numberThe latitude of the initial point, in degrees.
lon1numberThe longitude of the initial point, in degrees.
lat2numberThe latitude of the final point, in degrees.
lon2numberThe longitude of the final point, in degrees.

Returns

number

The initial true bearing, in degrees, from the initial point to the final point along the great circle connecting the two.

Defined in

src/sdk/geo/GeoPoint.ts:800


sphericalToCartesian

sphericalToCartesian(point, out): Float64Array

Calculates the cartesian (x, y, z) representation of a point, in units of great-arc radians. By convention, in the cartesian coordinate system the origin is at the center of the Earth, the positive x-axis passes through 0 degrees N, 0 degrees E, and the positive z-axis passes through the north pole.

Parameters

NameTypeDescription
pointLatLonInterfaceThe point to convert.
outFloat64ArrayThe vector array to which to write the result.

Returns

Float64Array

the cartesian representation of the point.

Defined in

src/sdk/geo/GeoPoint.ts:612

sphericalToCartesian(lat, lon, out): Float64Array

Calculates the cartesian (x, y, z) representation of a point, in units of great-arc radians. By convention, in the cartesian coordinate system the origin is at the center of the Earth, the positive x-axis passes through 0 degrees N, 0 degrees E, and the positive z-axis passes through the north pole.

Parameters

NameTypeDescription
latnumberThe latitude of the point to convert, in degrees.
lonnumberThe longitude of the point to convert, in degrees.
outFloat64ArrayThe vector array to which to write the result.

Returns

Float64Array

the cartesian representation of the point.

Defined in

src/sdk/geo/GeoPoint.ts:622