Library globals

Namespace globals . geo

View source

geo functions
-------------------------------------------------------------------------------------------------


geo.Coord class
-------------------------------------------------------------------------------------------------

geo.Coord.new([<coord>])        ... class that holds and maintains geographical coordinates
can be initialized with another geo.Coord instance

SETTER METHODS:

.set(<coord>)               ... sets coordinates from another geo.Coord instance

.set_lat(<num>)             ... functions for setting latitude/longitude/altitude
.set_lon(<num>)
.set_alt(<num>)             ..this is in meters
.set_latlon(<num>, <num> [, <num>])      (altitude (meters) is optional; default=0)

.set_x(<num>)               ... functions for setting cartesian x/y/z coordinates
.set_y(<num>)
.set_z(<num>)
.set_xyz(<num>, <num>, <num>)


GETTER METHODS:

.lat()
.lon()                      ... functions for getting lat/lon/alt
.alt()                          ... returns altitude in m
.latlon()                       ... returns vector  [<lat>, <lon>, <alt>]

.x()                        ... functions for reading cartesian coords (in m)
.y()
.z()
.xyz()                          ... returns vector  [<x>, <y>, <z>]


QUERY METHODS:

.is_defined()               ... returns whether the coords are defined
.dump()                     ... outputs coordinates
.course_to(<coord>)         ... returns course to another geo.Coord instance (degree)
.distance_to(<coord>)       ... returns distance in m along Earth curvature, ignoring altitudes
useful for map distance
.direct_distance_to(<coord>)      ...   distance in m direct, considers altitude,
but cuts through Earth surface
.greatcircle_distance_to(<coord>, <coord>)  ... returns distance to a great circle (in m along Earth curvature)
defined by two points  
.horizon()                  ... returns distance to the horizon in m along Earth curvature, ignoring altitudes


MANIPULATION METHODS:

.apply_course_distance(<course>, <distance>)       ... moves the coord distance in meters in course direction (true)




-------------------------------------------------------------------------------------------------

geo.aircraft_position()         ... returns current aircraft position as geo.Coord
geo.viewer_position()           ... returns viewer position as geo.Coord
geo.click_position()            ... returns last click coords as geo.Coord or nil before first click

geo.tile_path(<lat>, <lon>)     ... returns tile path string (e.g. "w130n30/w123n37/942056.stg")
geo.elevation(<lat>, <lon> [, <top:10000>])
... returns elevation in meter for given lat/lon, or nil on error;
<top> is the altitude at which the intersection test starts

geo.normdeg(<angle>)            ... returns angle normalized to    0 <= angle < 360
geo.normdeg180(<angle>)         ... returns angle normalized to -180 < angle <= 360

geo.put_model(<path>, <lat>, <lon> [, <elev:nil> [, <hdg:0> [, <pitch:0> [, <roll:0>]]]]);
... put model <path> at location <lat>/<lon> with given elevation
(optional, default: surface). <hdg>/<pitch>/<roll> are optional
and default to zero.
geo.put_model(<path>, <coord> [, <hdg:0> [, <pitch:0> [, <roll:0>]]]);
... same as above, but lat/lon/elev are taken from a Coord object

Classes

Coord

class that maintains one set of geographical coordinates

PositionedSearch

A object to handle differential positioned searches: searchCmd executes and returns the actual search, onAdded and onRemoved are callbacks, and obj is a "me" reference (defaults to "me" in the caller's namespace). If searchCmd returns nil, nothing happens, i.e. the diff is cancelled.

Functions

aircraft_position

click_position

elevation

format

normdeg

normalize degree to 0 <= angle < 360

normdeg180

normalize degree to -180 < angle <= 180

put_model

tile_index

tile_path

viewer_position

Variables

EPSILON

ERAD

click_coord