Skip to main content

Class: GeoPoint

Defined in: src/sdk/geo/GeoPoint.ts:346

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

Implements

Constructors

Constructor

new GeoPoint(lat, lon): GeoPoint

Defined in: src/sdk/geo/GeoPoint.ts:369

Constructor.

Parameters

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

Returns

GeoPoint

Properties

lat

readonly lat: 0 = 0

Defined in: src/sdk/geo/GeoPoint.ts:357

The latitude of this point, in degrees.

Implementation of

GeoPointInterface.lat


lon

readonly lon: 0 = 0

Defined in: src/sdk/geo/GeoPoint.ts:359

The longitude of this point, in degrees.

Implementation of

GeoPointInterface.lon


readonly

readonly readonly: GeoPointReadOnly

Defined in: src/sdk/geo/GeoPoint.ts:362

A readonly version of this point.


EQUALITY_TOLERANCE

readonly static EQUALITY_TOLERANCE: 1e-7 = GeoMath.ANGULAR_TOLERANCE

Defined in: src/sdk/geo/GeoPoint.ts:351

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

Methods

antipode()

antipode(out?): GeoPoint

Defined in: src/sdk/geo/GeoPoint.ts:606

Gets the antipode of this point.

Parameters

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

Returns

GeoPoint

The antipode of this point.

Implementation of

GeoPointInterface.antipode


bearingFrom()

Call Signature

bearingFrom(other): number

Defined in: src/sdk/geo/GeoPoint.ts:504

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
ParameterTypeDescription
otherReadonly<LatLonInterface>The other point.
Returns

number

The final true bearing from the other point, in degrees, or NaN if this point and the other point are coincident or antipodal. If this point is one of the poles, then the bearing will be expressed relative to the direction in which the meridian defined by this point's longitude crosses the pole rather than true north.

Implementation of

GeoPointInterface.bearingFrom

Call Signature

bearingFrom(lat, lon): number

Defined in: src/sdk/geo/GeoPoint.ts:506

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
ParameterTypeDescription
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, or NaN if this point and the other point are coincident or antipodal. If this point is one of the poles, then the bearing will be expressed relative to the direction in which the meridian defined by this point's longitude crosses the pole rather than true north.

Implementation of

GeoPointInterface.bearingFrom


bearingRhumb()

Call Signature

bearingRhumb(other): number

Defined in: src/sdk/geo/GeoPoint.ts:514

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

Parameters
ParameterTypeDescription
otherReadonly<LatLonInterface>The other point.
Returns

number

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

Implementation of

GeoPointInterface.bearingRhumb

Call Signature

bearingRhumb(lat, lon): number

Defined in: src/sdk/geo/GeoPoint.ts:516

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

Parameters
ParameterTypeDescription
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


bearingTo()

Call Signature

bearingTo(other): number

Defined in: src/sdk/geo/GeoPoint.ts:494

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

Parameters
ParameterTypeDescription
otherReadonly<LatLonInterface>The other point.
Returns

number

The initial true bearing to the other point, in degrees, or NaN if this point and the other point are coincident or antipodal. If this point is one of the poles, then the bearing will be expressed relative to the direction in which the meridian defined by this point's longitude crosses the pole rather than true north.

Implementation of

GeoPointInterface.bearingTo

Call Signature

bearingTo(lat, lon): number

Defined in: src/sdk/geo/GeoPoint.ts:496

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

Parameters
ParameterTypeDescription
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, or NaN if this point and the other point are coincident or antipodal. If this point is one of the poles, then the bearing will be expressed relative to the direction in which the meridian defined by this point's longitude crosses the pole rather than true north.

Implementation of

GeoPointInterface.bearingTo


copy()

copy(to?): GeoPoint

Defined in: src/sdk/geo/GeoPoint.ts:636

Copies this point.

Parameters

ParameterTypeDescription
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


distance()

Call Signature

distance(other): number

Defined in: src/sdk/geo/GeoPoint.ts:474

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

Parameters
ParameterTypeDescription
otherReadonly<LatLonInterface>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

Call Signature

distance(lat, lon): number

Defined in: src/sdk/geo/GeoPoint.ts:476

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

Parameters
ParameterTypeDescription
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


distanceRhumb()

Call Signature

distanceRhumb(other): number

Defined in: src/sdk/geo/GeoPoint.ts:484

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

Parameters
ParameterTypeDescription
otherReadonly<LatLonInterface>The other point.
Returns

number

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

Implementation of

GeoPointInterface.distanceRhumb

Call Signature

distanceRhumb(lat, lon): number

Defined in: src/sdk/geo/GeoPoint.ts:486

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

Parameters
ParameterTypeDescription
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


equals()

Call Signature

equals(other, tolerance?): boolean

Defined in: src/sdk/geo/GeoPoint.ts:616

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
ParameterTypeDescription
otherReadonly<LatLonInterface>The 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

Call Signature

equals(lat, lon, tolerance?): boolean

Defined in: src/sdk/geo/GeoPoint.ts:618

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
ParameterTypeDescription
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


isValid()

isValid(): boolean

Defined in: src/sdk/geo/GeoPoint.ts:405

Checks whether this point is valid. This point is valid if and only if both latitude and longitude are finite.

Returns

boolean

Whether this point is valid.

Implementation of

GeoPointInterface.isValid


offset()

offset(bearing, distance, out?): GeoPoint

Defined in: src/sdk/geo/GeoPoint.ts:532

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

Parameters

ParameterTypeDescription
bearingnumberThe bearing along which to offset, in degrees relative to true north. If this point is one of the poles, then the bearing will be measured relative to the direction in which the meridian defined by this point's longitude crosses the pole rather than the direction of true north.
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


offsetRhumb()

offsetRhumb(bearing, distance, out?): GeoPoint

Defined in: src/sdk/geo/GeoPoint.ts:575

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

Parameters

ParameterTypeDescription
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


set()

Call Signature

set(other): this

Defined in: src/sdk/geo/GeoPoint.ts:414

Sets this point's latitude/longitude values.

Parameters
ParameterTypeDescription
otherReadonly<LatLonInterface>The point from which to take the new latitude/longitude values.
Returns

this

This point, after it has been changed.

Call Signature

set(lat, lon): this

Defined in: src/sdk/geo/GeoPoint.ts:421

Sets this point's latitude/longitude values.

Parameters
ParameterTypeDescription
latnumberThe new latitude, in degrees.
lonnumberThe new longitude, in degrees.
Returns

this

This point, after it has been changed.


setFromCartesian()

Call Signature

setFromCartesian(vec): this

Defined in: src/sdk/geo/GeoPoint.ts:453

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
ParameterTypeDescription
vecReadonlyFloat64ArrayA position vector defining the new coordinates.
Returns

this

This point, after it has been changed.

Call Signature

setFromCartesian(x, y, z): this

Defined in: src/sdk/geo/GeoPoint.ts:463

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
ParameterTypeDescription
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.


toCartesian()

toCartesian(out): Float64Array

Defined in: src/sdk/geo/GeoPoint.ts:611

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

ParameterTypeDescription
outFloat64ArrayThe vector array to which to write the result.

Returns

Float64Array

The cartesian representation of this point.

Implementation of

GeoPointInterface.toCartesian


bearingRhumb()

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

Defined in: src/sdk/geo/GeoPoint.ts:891

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

Parameters

ParameterTypeDescription
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.


distance()

Call Signature

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

Defined in: src/sdk/geo/GeoPoint.ts:721

Calculates the great-circle distance between two points.

Parameters
ParameterTypeDescription
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.

Call Signature

static distance(point1, point2): number

Defined in: src/sdk/geo/GeoPoint.ts:728

Calculates the great-circle distance between two points.

Parameters
ParameterTypeDescription
point1Readonly<LatLonInterface>The first point.
point2Readonly<LatLonInterface>The second point.
Returns

number

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

Call Signature

static distance(point1, point2): number

Defined in: src/sdk/geo/GeoPoint.ts:735

Calculates the great-circle distance between two points.

Parameters
ParameterTypeDescription
point1ReadonlyFloat64ArrayThe first point, in cartesian form.
point2ReadonlyFloat64ArrayThe second point, in cartesian form.
Returns

number

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


distanceRhumb()

Call Signature

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

Defined in: src/sdk/geo/GeoPoint.ts:781

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

Parameters
ParameterTypeDescription
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.

Call Signature

static distanceRhumb(point1, point2): number

Defined in: src/sdk/geo/GeoPoint.ts:788

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

Parameters
ParameterTypeDescription
point1Readonly<LatLonInterface>The first point.
point2Readonly<LatLonInterface>The second point.
Returns

number

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

Call Signature

static distanceRhumb(point1, point2): number

Defined in: src/sdk/geo/GeoPoint.ts:795

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

Parameters
ParameterTypeDescription
point1ReadonlyFloat64ArrayThe first point, in cartesian form.
point2ReadonlyFloat64ArrayThe second point, in cartesian form.
Returns

number

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


equals()

Call Signature

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

Defined in: src/sdk/geo/GeoPoint.ts:677

Checks whether two points are equal.

Parameters
ParameterTypeDescription
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.

Call Signature

static equals(point1, point2, tolerance?): boolean

Defined in: src/sdk/geo/GeoPoint.ts:686

Checks whether two points are equal.

Parameters
ParameterTypeDescription
point1Readonly<LatLonInterface>The first point.
point2Readonly<LatLonInterface>The 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.

Call Signature

static equals(point1, point2, tolerance?): boolean

Defined in: src/sdk/geo/GeoPoint.ts:695

Checks whether two points are equal.

Parameters
ParameterTypeDescription
point1ReadonlyFloat64ArrayThe first point, in cartesian form.
point2ReadonlyFloat64ArrayThe 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.


finalBearing()

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

Defined in: src/sdk/geo/GeoPoint.ts:878

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

Parameters

ParameterTypeDescription
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, or NaN if the two points are coincident or antipodal. If the final point is one of the poles, then the bearing will be expressed relative to the direction in which the meridian defined by the final point's longitude crosses the pole rather than true north.


initialBearing()

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

Defined in: src/sdk/geo/GeoPoint.ts:848

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

Parameters

ParameterTypeDescription
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, or NaN if the two points are coincident or antipodal. If the initial point is one of the poles, then the bearing will be expressed relative to the direction in which the meridian defined by the initial point's longitude crosses the pole rather than true north.


sphericalToCartesian()

Call Signature

static sphericalToCartesian(point, out): Float64Array

Defined in: src/sdk/geo/GeoPoint.ts:648

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
ParameterTypeDescription
pointReadonly<LatLonInterface>The point to convert.
outFloat64ArrayThe vector array to which to write the result.
Returns

Float64Array

the cartesian representation of the point.

Call Signature

static sphericalToCartesian(lat, lon, out): Float64Array

Defined in: src/sdk/geo/GeoPoint.ts:658

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
ParameterTypeDescription
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.