GeoLocation Class
Every instance of GeoLocation represents a location in the
earth's three-dimensional space.
A GeoLocation
consists of latitude and longitude and an optional altitude
property. If the altitude is not specified, the altitude will be
set to AR.CONST.UNKNOWN_ALTITUDE. In the application, the
altitude of the location will implicitly set to the user's
current altitude.
The Coordinate system used is WGS
84 (see the
Wikipedia article for details).
Typically,
GeoLocations will be created and then used for the creation of
GeoObjects and ActionRanges.
var location1 = new AR.GeoLocation(47.77317, 13.069929); var altitude = location1.altitude; //altitude = -32768 var location2 = new AR.GeoLocation(47.77317, 13.069929, 320.); altitude = location2.altitude; //alt = 320 var object1 = new AR.GeoObject(location1); var object2 = new AR.GeoObject(location2);
Constructor
Item Index
Methods
Methods
destroy
()
Destroys the object.
distanceTo
-
location
Returns the shortest distance ("as the crow flies")
to the Location passed as an argument, ignoring any altitude property.
var location1 = new AR.GeoLocation(47.77317, 13.069929); var location2 = new AR.GeoLocation(47.77317, 13.069929, 320.); var location3 = new AR.GeoLocation(47.77317, 14.069929, 640.); var dist = location2.distanceTo(location1); //dist = 0. dist = location2.distanceTo(location3); //dist = 74730.
Parameters:
-
location
LocationThe Location the distance should be calculated for.
Returns:
The numeric distance in meters.
Properties
altitude
Number
The altitude of the location, in meters. Values must be numeric values, otherwise, an Exception will be thrown.
Default: AR.CONST.UNKNOWN_ALTITUDE
latitude
Number
The latitude of the location, in decimal degrees. Values must be numeric values in range [-90, 90], otherwise, an Exception will be thrown.
longitude
Number
The longitude of the location, in decimal degrees. Values must be numeric values in range [-180, 180], otherwise, an Exception will be thrown.