Documentation
¶
Overview ¶
Package egm96 provides a representation of the 1996 Earth Gravitational Model (EGM96), a geopotential model of the Earth.
EGM96 is the geoid reference model component of the World Geodetic System (WGS84). It consists of n=m=360 spherical harmonic coefficients as published by the National Geospatial-Intelligence Agency (NGA). The NGA also publishes a raster grid of the calculated heights which can be interpolated to approximate the geoid height at any location.
In effect, this model provides the height of sea level above the WGS84 reference ellipsoid. It is used, for example, in GPS navigation to provide the height above sea level.
This package is based on the NGA-provided 15'x15' resolution grid encoding the heights of the geopotential surface at each lat/long, and interpolates between grid points using a bilinear interpolation.
Index ¶
Constants ¶
const ( A = 6378137 // Equatorial radius of WGS84 reference ellipsoid in meters F = 1 / 298.257223563 // Flattening of WGS84 reference ellipsoid E2 = F * (2 - F) // Eccentricity squared of WGS84 reference ellipsoid )
Constants defining the WGS84 reference ellipsoid
const ( Deg = 1 / 57.29577951308232 // number of radians per degree Ft = 0.3048 // number of meters per foot )
Factors for converting between radians and degrees and between meters and feet.
Variables ¶
This section is empty.
Functions ¶
func DMSToDegrees ¶
DMSToDegrees converts integral degrees d, minutes m and seconds s (all of type float64) to a float-valued degrees amount.
If d<0 then must pass m>0 and s>0; if d==0 and m<0 then must pass s>0.
func DegreesToDMS ¶
DegreesToDMS converts float degrees dd to whole degrees d, minutes m and decimal seconds s (all of type float64).
Types ¶
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
Location is a type that represents a position in space as represented by a latitude, a longitude and a height.
func NewLocationGeodetic ¶
NewLocationGeodetic returns a Location given an input latitude, longitude, and height specified in the Geodetic system.
The Geodetic coordinate system is the usual latitude, longitude, and height above the WGS84 Reference Ellipsoid, i.e. as typically measured by a GPS receiver.
Latitude and longitude are specified in decimal degrees and height in meters.
Geodetic coordinates are the un-primed variables φ,λ,h in the WMM paper.
func NewLocationMSL ¶
NewLocationMSL returns a Location given an input latitude, longitude, and height above mean sea level.
The latitude and longitude are as specified in the Geodetic Coordinate System, and the height is the height above mean sea level, NOT above the WGS84 Reference Ellipsoid.
Latitude and longitude are specified in decimal degrees and height in meters.
func (Location) Equals ¶
Equals returns whether the latitude, longitude and height of the input location are equal to those of the caller.
func (Location) Geodetic ¶
Geodetic returns the location's lat (latitude), lng (longitude), and h (height). lat and lng are in radians and r is in meters. Geodetic coordinates are the variables φ,λ,h in the WMM paper.
func (Location) HeightAboveMSL ¶
HeightAboveMSL calculates the height of the EGM96 geoid at the input Location, which corresponds to the height of MSL relative to the WGS84 reference ellipsoid. It then subtracts this height from the total height above the WGS84 reference ellipsoid at the input Location, giving the the height above MSL.
func (Location) NearestEGM96GridPoint ¶
NearestEGM96GridPoint looks up the grid point nearest the desired location within the 15'x15' resolution grid data for the EGM96 geoid model.
The returned Location contains the lat/long of the grid point and the height in meters of the geoid relative to the WGS 84 reference ellipsoid at that grid point.
Ignores any height value in the input Location.
func (Location) Spherical ¶
Spherical returns the location's phi (φ', corresponding to latitude), lambda (λ, equal to geodetic longitude), and r (r, distance from center of WGS sphere). phi and lambda are in radians and r is in meters. Spherical coordinates are the variables φ',λ,r in the WMM paper.