Class: Location

Location(latitude, longitude)

Represents a latitude, longitude pair in degrees.

Constructor

new Location(latitude, longitude)

Constructs a location from a specified latitude and longitude in degrees.
Parameters:
Name Type Description
latitude Number The latitude in degrees.
longitude Number The longitude in degrees.
Source:

Members

(static) poles :Object

A bit mask indicating which if any pole is being referenced. This corresponds to Java WW's AVKey.NORTH and AVKey.SOUTH, although this encoding can capture both poles simultaneously, which was a 'to do' item in the Java implementation.
Type:
  • Object
Source:

(static, constant) ZERO :Location

A location with latitude and longitude both 0.
Type:
Source:

latitude :Number

The latitude in degrees.
Type:
  • Number
Source:

longitude :Number

The longitude in degrees.
Type:
  • Number
Source:

Methods

(static) fromRadians(latitudeRadians, longitudeRadians) → {Location}

Creates a location from angles specified in radians.
Parameters:
Name Type Description
latitudeRadians Number The latitude in radians.
longitudeRadians Number The longitude in radians.
Source:
Returns:
The new location with latitude and longitude in degrees.
Type
Location

(static) greatCircleArcExtremeForTwoLocations(begin, end) → {Array.<Location>}

Returns two locations with the most extreme latitudes on the great circle arc defined by, and limited to, the two locations.
Parameters:
Name Type Description
begin Location Beginning location on the great circle arc.
end Location Ending location on the great circle arc.
Source:
Throws:
If either begin or end are null.
Type
ArgumentError
Returns:
Two locations with the most extreme latitudes on the great circle arc.
Type
Array.<Location>

(static) greatCircleArcExtremeLocations(locations) → {Array.<Location>}

Returns two locations with the most extreme latitudes on the sequence of great circle arcs defined by each pair of locations in the specified iterable.
Parameters:
Name Type Description
locations Array.<Location> The pairs of locations defining a sequence of great circle arcs.
Source:
Throws:
IllegalArgumentException if locations is null.
Returns:
Two locations with the most extreme latitudes on the great circle arcs.
Type
Array.<Location>

(static) greatCircleAzimuth(location1, location2) → {Number}

Computes the azimuth angle (clockwise from North) that points from the first location to the second location. This angle can be used as the starting azimuth for a great circle arc that begins at the first location, and passes through the second location. This function uses a spherical model, not elliptical.
Parameters:
Name Type Description
location1 Location The starting location.
location2 Location The ending location.
Source:
Throws:
If either specified location is null or undefined.
Type
ArgumentError
Returns:
The computed azimuth, in degrees.
Type
Number

(static) greatCircleDistance(location1, location2) → {Number}

Computes the great circle angular distance between two locations. The return value gives the distance as the angle between the two positions. In radians, this angle is the arc length of the segment between the two positions. To compute a distance in meters from this value, multiply the return value by the radius of the globe. This function uses a spherical model, not elliptical.
Parameters:
Name Type Description
location1 Location The starting location.
location2 Location The ending location.
Source:
Throws:
If either specified location is null or undefined.
Type
ArgumentError
Returns:
The computed distance, in radians.
Type
Number

(static) greatCircleExtremeLocationsUsingAzimuth(location, azimuth) → {Array.<Location>}

Returns two locations with the most extreme latitudes on the great circle with the given starting location and azimuth.
Parameters:
Name Type Description
location Location Location on the great circle.
azimuth number Great circle azimuth angle (clockwise from North).
Source:
Throws:
If location is null.
Type
ArgumentError
Returns:
Two locations where the great circle has its extreme latitudes.
Type
Array.<Location>

(static) greatCircleLocation(location, greatCircleAzimuthDegrees, pathLengthRadians, result) → {Location}

Computes the location on a great circle path corresponding to a given starting location, azimuth, and arc distance. This function uses a spherical model, not elliptical.
Parameters:
Name Type Description
location Location The starting location.
greatCircleAzimuthDegrees Number The azimuth in degrees.
pathLengthRadians Number The radian distance along the path at which to compute the end location.
result Location A Location in which to return the result.
Source:
Throws:
If the specified location or the result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result location.
Type
Location

(static) interpolateAlongPath(pathType, amount, location1, location2, result) → {Location}

Compute a location along a path at a specified distance between two specified locations.
Parameters:
Name Type Description
pathType String The type of path to assume. Recognized values are WorldWind.GREAT_CIRCLE, WorldWind.RHUMB_LINE and WorldWind.LINEAR. If the path type is not recognized then WorldWind.LINEAR is used.
amount Number The fraction of the path between the two locations at which to compute the new location. This number should be between 0 and 1. If not, it is clamped to the nearest of those values.
location1 Location The starting location.
location2 Location The ending location.
result Location A Location in which to return the result.
Source:
Throws:
If either specified location or the result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result location.
Type
Location

(static) interpolateGreatCircle(amount, location1, location2, result) → {Location}

Compute a location along a great circle path at a specified distance between two specified locations.
Parameters:
Name Type Description
amount Number The fraction of the path between the two locations at which to compute the new location. This number should be between 0 and 1. If not, it is clamped to the nearest of those values. This function uses a spherical model, not elliptical.
location1 Location The starting location.
location2 Location The ending location.
result Location A Location in which to return the result.
Source:
Throws:
If either specified location or the result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result location.
Type
Location

(static) interpolateLinear(amount, location1, location2, result) → {Location}

Compute a location along a linear path at a specified distance between two specified locations.
Parameters:
Name Type Description
amount Number The fraction of the path between the two locations at which to compute the new location. This number should be between 0 and 1. If not, it is clamped to the nearest of those values.
location1 Location The starting location.
location2 Location The ending location.
result Location A Location in which to return the result.
Source:
Throws:
If either specified location or the result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result location.
Type
Location

(static) interpolateRhumb(amount, location1, location2, result) → {Location}

Compute a location along a rhumb path at a specified distance between two specified locations. This function uses a spherical model, not elliptical.
Parameters:
Name Type Description
amount Number The fraction of the path between the two locations at which to compute the new location. This number should be between 0 and 1. If not, it is clamped to the nearest of those values.
location1 Location The starting location.
location2 Location The ending location.
result Location A Location in which to return the result.
Source:
Throws:
If either specified location or the result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result location.
Type
Location

(static) intersectionWithMeridian(p1, p2, meridian, globe) → {number}

Determine where a line between two positions crosses a given meridian. The intersection test is performed by intersecting a line in Cartesian space between the two positions with a plane through the meridian. Thus, it is most suitable for working with positions that are fairly close together as the calculation does not take into account great circle or rhumb paths.
Parameters:
Name Type Description
p1 Location First position.
p2 Location Second position.
meridian number Longitude line to intersect with.
globe Globe Globe used to compute intersection.
Source:
Returns:
latitude The intersection latitude along the meridian TODO: this code allocates 4 new Vec3 and 1 new Position; use scratch variables??? TODO: Why not? Every location created would then allocated those variables as well, even if they aren't needed :(.
Type
number

(static) linearAzimuth(location1, location2) → {Number}

Computes the azimuth angle (clockwise from North) that points from the first location to the second location. This angle can be used as the azimuth for a linear arc that begins at the first location, and passes through the second location.
Parameters:
Name Type Description
location1 Location The starting location.
location2 Location The ending location.
Source:
Throws:
If either specified location is null or undefined.
Type
ArgumentError
Returns:
The computed azimuth, in degrees.
Type
Number

(static) linearDistance(location1, location2) → {Number}

Computes the linear angular distance between two locations. The return value gives the distance as the angle between the two positions in radians. This angle is the arc length of the segment between the two positions. To compute a distance in meters from this value, multiply the return value by the radius of the globe.
Parameters:
Name Type Description
location1 Location The starting location.
location2 Location The ending location.
Source:
Throws:
If either specified location is null or undefined.
Type
ArgumentError
Returns:
The computed distance, in radians.
Type
Number

(static) linearLocation(location, azimuthDegrees, pathLengthRadians, result) → {Location}

Computes the location on a linear path with the given starting location, azimuth, and arc distance.
Parameters:
Name Type Description
location Location The starting location.
azimuthDegrees Number The azimuth in degrees.
pathLengthRadians Number The radian distance along the path at which to compute the location.
result Location A Location in which to return the result.
Source:
Throws:
If the specified location or the result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result location.
Type
Location

(static) locationsCrossDateLine(locations) → {boolean}

Determine whether a list of locations crosses the dateline.
Parameters:
Name Type Description
locations Array.<Location> The locations to test.
Source:
Throws:
If the locations list is null.
Type
ArgumentError
Returns:
True if the dateline is crossed, else false.
Type
boolean

(static) meridianIntersection(p1, p2, meridian) → {number|null}

Determine where a line between two positions crosses a given meridian. The intersection test is performed by intersecting a line in Cartesian space. Thus, it is most suitable for working with positions that are fairly close together as the calculation does not take into account great circle or rhumb paths.
Parameters:
Name Type Description
p1 Location | Position First position.
p2 Location | Position Second position.
meridian number Longitude line to intersect with.
Source:
Returns:
latitude The intersection latitude along the meridian or null if the line is collinear with the meridian
Type
number | null

(static) rhumbAzimuth(location1, location2) → {Number}

Computes the azimuth angle (clockwise from North) that points from the first location to the second location. This angle can be used as the azimuth for a rhumb arc that begins at the first location, and passes through the second location. This function uses a spherical model, not elliptical.
Parameters:
Name Type Description
location1 Location The starting location.
location2 Location The ending location.
Source:
Throws:
If either specified location is null or undefined.
Type
ArgumentError
Returns:
The computed azimuth, in degrees.
Type
Number

(static) rhumbDistance(location1, location2) → {Number}

Computes the rhumb angular distance between two locations. The return value gives the distance as the angle between the two positions in radians. This angle is the arc length of the segment between the two positions. To compute a distance in meters from this value, multiply the return value by the radius of the globe. This function uses a spherical model, not elliptical.
Parameters:
Name Type Description
location1 Location The starting location.
location2 Location The ending location.
Source:
Throws:
If either specified location is null or undefined.
Type
ArgumentError
Returns:
The computed distance, in radians.
Type
Number

(static) rhumbLocation(location, azimuthDegrees, pathLengthRadians, result) → {Location}

Computes the location on a rhumb arc with the given starting location, azimuth, and arc distance. This function uses a spherical model, not elliptical.
Parameters:
Name Type Description
location Location The starting location.
azimuthDegrees Number The azimuth in degrees.
pathLengthRadians Number The radian distance along the path at which to compute the location.
result Location A Location in which to return the result.
Source:
Throws:
If the specified location or the result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result location.
Type
Location

copy(location) → {Location}

Copies this location to the latitude and longitude of a specified location.
Parameters:
Name Type Description
location Location The location to copy.
Source:
Throws:
If the specified location is null or undefined.
Type
ArgumentError
Returns:
This location, set to the values of the specified location.
Type
Location

equals(location) → {Boolean}

Indicates whether this location is equal to a specified location.
Parameters:
Name Type Description
location Location The location to compare this one to.
Source:
Returns:
true if this location is equal to the specified location, otherwise false.
Type
Boolean

set(latitude, longitude) → {Location}

Sets this location to the latitude and longitude.
Parameters:
Name Type Description
latitude Number The latitude to set.
longitude Number The longitude to set.
Source:
Returns:
This location, set to the values of the specified latitude and longitude.
Type
Location