Documentation ¶
Index ¶
- Constants
- type Ellipsoid
- func (ellipsoid Ellipsoid) At(lat1, lon1, distance, bearing float64) (lat2, lon2 float64)
- func (ellipsoid Ellipsoid) Displacement(lat1, lon1, lat2, lon2 float64) (x, y float64)
- func (ellipsoid Ellipsoid) Intermediate(lat1, lon1, lat2, lon2 float64, steps int) (distance, bearing float64, arr []float64)
- func (ellipsoid Ellipsoid) Location(lat1, lon1, x, y float64) (lat, lon float64)
- func (ellipsoid Ellipsoid) To(lat1, lon1, lat2, lon2 float64) (distance, bearing float64)
- func (ellipsoid Ellipsoid) ToECEF(lat1, lon1, alt1 float64) (x, y, z float64)
- func (ellipsoid Ellipsoid) ToLLA(x, y, z float64) (lat1, lon1, alt1 float64)
- type Location
Constants ¶
const ( // Meter is one of the output/input units. Meter = 0 // 1.0 meter // Foot is one of the output/input units. Foot = 1 // 0.3048 meter are a foot // Kilometer is one of the output/input units. Kilometer = 2 // 1000.0 meter are a kilometer // Mile is one of the output/input units. Mile = 3 // 1609.344 meter are a mile // Nm (nautical mile) is one of the output/input units. Nm = 4 // 1852.0 meter are a nautical mile, // Degrees is one of the possible angle units for input/output. Degrees = iota // Radians is one of the possible angle units for input/output. Radians = iota // LongitudeIsSymmetric determines that the output longitude shall be symmetric. LongitudeIsSymmetric = true // LongitudeNotSymmetric determines that the output longitude shall not be symmetric. LongitudeNotSymmetric = false // BearingIsSymmetric determines that the output bearing shall be symmetric. BearingIsSymmetric = true // BearingNotSymmetric determines that the output bearing shall not be symmetric. BearingNotSymmetric = false )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ellipsoid ¶
type Ellipsoid struct { Ellipse ellipse Units int DistanceUnits int LongitudeSymmetric bool BearingSymmetry bool DistanceFactor float64 }
Ellipsoid is the main object to store information about one ellispoid.
func Init ¶
Init
The Init constructor must be called with a list of parameters to set the value of the ellipsoid to be used, the value of the units to be used for angles and distances, and whether or not the output range of longitudes and bearing angles should be symmetric around zero or always greater than zero. There is no default constructor, all arguments are required; they may not be abbreviated.
Example:
geo := ellipsoid.Init( "WGS84", // for possible values see below. ellipsoid.Degrees, // possible values: Degrees or Radians ellipsoid.Meter, // possible values: Meter, Kilometer, // Foot, Nm, Mile ellipsoid.LongitudeIsSymmetric, // possible values // LongitudeIsSymmetric or // LongitudeNotSymmetric ellipsoid.BearingIsSymmetric // possible // values BearingIsSymmetric or // BearingNotSymmetric )
func (Ellipsoid) At ¶
At returns the list latitude,longitude in degrees or radians that is a
specified range and bearing from a given location.
lat2, lon2 = geo.At( lat1, lon1, range, bearing )
func (Ellipsoid) Displacement ¶
Displacement returns the (x,y) displacement in distance units between the two specified
locations.
x, y = geo.Displacement( lat1, lon1, lat2, lon2 )
NOTE: The x and y displacements are only approximations and only valid between two locations that are fairly near to each other. Beyond 10 kilometers or more, the concept of X and Y on a curved surface loses its meaning.
func (Ellipsoid) Intermediate ¶
func (ellipsoid Ellipsoid) Intermediate(lat1, lon1, lat2, lon2 float64, steps int) (distance, bearing float64, arr []float64)
Intermediate
Takes two coordinates with longitude and latitude; and a step count and returns range and bearing and an array with the lons and lats of intermediate points on a straight line (whatever that is on an ellipsoid), INCLUDING the start and the endpoint.
So if you put in point1 and point2 with step count 4, the output will be (you make 4 hops, right?)
point1 i1 i2 i3 point2
Each point is two float64 values, lat and lon, thus you have an array with 4*2 + 2 = 5*2 cells.
steps shall not be 0.
I havent tested the upper limit for steps.
func (Ellipsoid) Location ¶
Location returns the list (latitude,longitude) of a location at a given (x,y)
displacement from a given location.
lat2, lon2 = geo.Location( lat1, lon1, x, y )
The note from Displacement applies.
func (Ellipsoid) To ¶
To returns range, bearing between two specified locations.
dist, theta = geo.To( lat1, lon1, lat2, lon2 )
func (Ellipsoid) ToECEF ¶
ToECEF takes the latitude, longitude, elevation list and
returns three cartesian coordinates x, y, z