Constructor
new Geodesic(a, f)
Initialize a Geodesic object for a specific ellipsoid.
Parameters:
Name | Type | Description |
---|---|---|
a |
number | the equatorial radius of the ellipsoid (meters). |
f |
number | the flattening of the ellipsoid. Setting f = 0 gives a sphere (on which geodesics are great circles). Negative f gives a prolate ellipsoid. |
Properties:
Name | Type | Description |
---|---|---|
a |
number | the equatorial radius (meters). |
f |
number | the flattening. |
Throws:
an error if the parameters are illegal.
Example
var geodesic = require("geographiclib-geodesic"),
geod = geodesic.Geodesic.WGS84;
var inv = geod.Inverse(1,2,3,4);
console.log("lat1 = " + inv.lat1 + ", lon1 = " + inv.lon1 +
", lat2 = " + inv.lat2 + ", lon2 = " + inv.lon2 +
",\nazi1 = " + inv.azi1 + ", azi2 = " + inv.azi2 +
", s12 = " + inv.s12);
Methods
ArcDirect(lat1, lon1, azi1, a12, outmaskopt) → {object}
Solve the direct geodesic problem with arc length.
The lat1, lon1, azi1, and a12 fields of the result are always set. For details on the outmask parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
azi1 |
number | the azimuth at the first point in degrees. |
||
a12 |
number | the arc length from the first point to the second in degrees. |
||
outmask |
bitmask |
<optional> |
STANDARD | which results to include. |
Returns:
the requested results.
- Type
- object
ArcDirectLine(lat1, lon1, azi1, a12, capsopt) → {object}
Define a GeodesicLine in terms of the direct geodesic problem specified in terms of arc length.
This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem. For details on the caps parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
azi1 |
number | the azimuth at the first point in degrees. degrees. |
||
a12 |
number | the arc length between point 1 and point 2 (degrees); it can be negative. |
||
caps |
bitmask |
<optional> |
STANDARD | DISTANCE_IN | which capabilities to include. |
Returns:
the GeodesicLine object
- Type
- object
Direct(lat1, lon1, azi1, s12, outmaskopt) → {object}
Solve the direct geodesic problem.
The lat1, lon1, azi1, s12, and a12 fields of the result are always set. For details on the outmask parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
azi1 |
number | the azimuth at the first point in degrees. |
||
s12 |
number | the distance from the first point to the second in meters. |
||
outmask |
bitmask |
<optional> |
STANDARD | which results to include. |
Returns:
the requested results.
- Type
- object
DirectLine(lat1, lon1, azi1, s12, capsopt) → {object}
Define a GeodesicLine in terms of the direct geodesic problem specified in terms of distance.
This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem. For details on the caps parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
azi1 |
number | the azimuth at the first point in degrees. degrees. |
||
s12 |
number | the distance between point 1 and point 2 (meters); it can be negative. |
||
caps |
bitmask |
<optional> |
STANDARD | DISTANCE_IN | which capabilities to include. |
Returns:
the GeodesicLine object
- Type
- object
GenDirect(lat1, lon1, azi1, arcmode, s12_a12, outmaskopt) → {object}
Solve the general direct geodesic problem.
The lat1, lon1, azi1, and a12 fields of the result are always set; s12 is included if arcmode is false. For details on the outmask parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
azi1 |
number | the azimuth at the first point in degrees. |
||
arcmode |
bool | is the next parameter an arc length? |
||
s12_a12 |
number | the (arcmode ? arc length : distance) from the first point to the second in (arcmode ? degrees : meters). |
||
outmask |
bitmask |
<optional> |
STANDARD | which results to include. |
Returns:
the requested results.
- Type
- object
GenDirectLine(lat1, lon1, azi1, arcmode, s12_a12, capsopt) → {object}
Define a GeodesicLine in terms of the direct geodesic problem specified in terms of either distance or arc length.
This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem. For details on the caps parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
azi1 |
number | the azimuth at the first point in degrees. degrees. |
||
arcmode |
bool | boolean flag determining the meaning of the s12_a12. |
||
s12_a12 |
number | if arcmode is false, this is the distance between point 1 and point 2 (meters); otherwise it is the arc length between point 1 and point 2 (degrees); it can be negative. |
||
caps |
bitmask |
<optional> |
STANDARD | DISTANCE_IN | which capabilities to include. |
Returns:
the GeodesicLine object
- Type
- object
Inverse(lat1, lon1, lat2, lon2, outmaskopt) → {object}
Solve the inverse geodesic problem.
The lat1, lon1, lat2, lon2, and a12 fields of the result are always set. For details on the outmask parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
lat2 |
number | the latitude of the second point in degrees. |
||
lon2 |
number | the longitude of the second point in degrees. |
||
outmask |
bitmask |
<optional> |
STANDARD | which results to include. |
Returns:
the requested results
- Type
- object
InverseLine(lat1, lon1, lat2, lon2, capsopt) → {object}
Define a GeodesicLine in terms of the inverse geodesic problem.
This function sets point 3 of the GeodesicLine to correspond to point 2 of the inverse geodesic problem. For details on the caps parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
lat2 |
number | the latitude of the second point in degrees. |
||
lon2 |
number | the longitude of the second point in degrees. |
||
caps |
bitmask |
<optional> |
STANDARD | DISTANCE_IN | which capabilities to include. |
Returns:
the GeodesicLine object
- Type
- object
Line(lat1, lon1, azi1, capsopt) → {object}
Create a GeodesicLine object.
For details on the caps parameter, see The library interface, "The outmask and caps parameters".
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat1 |
number | the latitude of the first point in degrees. |
||
lon1 |
number | the longitude of the first point in degrees. |
||
azi1 |
number | the azimuth at the first point in degrees. degrees. |
||
caps |
bitmask |
<optional> |
STANDARD | DISTANCE_IN | which capabilities to include. |
Returns:
the GeodesicLine object
- Type
- object
Polygon(polylineopt) → {object}
Create a PolygonArea object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
polyline |
bool |
<optional> |
false | if true the new PolygonArea object describes a polyline instead of a polygon. |
Returns:
the PolygonArea object
- Type
- object