wgs84

package module
v0.0.0-...-bc00bcc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2015 License: Apache-2.0 Imports: 1 Imported by: 0

README

go-geo-wgs84

Package wgs84 provides forward and inverse geodesic calculations on the WGS84 ellipsoid.

This code used to live in code.google.com/p/lvd.go/geo/wgs84.

GoDoc

Documentation

Overview

This package provides forward and inverse geodesic calculations on the WGS84 ellipsoid.

The calculations are borrowed from the GeographicLib C++ library by Charles Karney. Its Geoid class is replaced by hardcoded WGS84 with the sperical harmonics computed to 8'th order. The forward function is lifted from the C++ code for GeodesicLine(lat1, lon1, azi1..).GenPosition(s12...) and it's dependents, the inverse function is Geodesic::GenInverse.

The documentation for the Original C++ classes can be found at

http://geographiclib.sourceforge.net/html/annotated.html

Index

Constants

View Source
const (
	WGS84_a = 6378137.             // Equatorial radius in meters
	WGS84_f = 1. / 298.25722210088 // Flattening of the ellipsoid
)

Variables

This section is empty.

Functions

func Forward

func Forward(lat1, lon1, azi1, s12 float64) (lat2, lon2, azi2 float64)

Compute the Point (lat2, lon2) obtained by following the geodesic line from (lat1,lon2) in the direction azi1 over a distance of s12 [meters] and the arriving azimuth azi2. All angles are in radians. Azimuths are clockwise from the North. Positive latitudes are North, positive longitudes are East. Unlike the C++ original, azi2 points in the incoming direction.

func Inverse

func Inverse(lat1, lon1, lat2, lon2 float64) (s12, azi1, azi2 float64)

Given two points (lat1, lon1) and (lat2, lon2), compute a geodesic between them, and return the distance in meters and the azimuths in both points. All angles are in radians. Azimuths are clockwise from the north. Positive latitudes are North, positive Longitudes are East. Unlike the C++ original, azi2 points in the incoming direction.

Types

type GeodesicLine

type GeodesicLine struct {
	// contains filtered or unexported fields
}

A GeodesicLine represents a geodesic around the ellipsoid based in some point, under some azimuth.

func NewGeodesicLine

func NewGeodesicLine(lat1, lon1, azi1 float64) *GeodesicLine

Construct an object representing a geodesic line through (lat1, lon1) at azimuth azi1. All angles are in radians. Azimuths are clockwise from the North. Positive latitudes are North, positive longitudes are East.

func (*GeodesicLine) Position

func (g *GeodesicLine) Position(s12 float64) (lat2, lon2, azi2 float64)

Compute the Point (lat2,lon2) obtained by following the geodesic line from it's basepoint over a distance of s12 [meters] and the arriving azimuth azi2. All angles are in radians. Azimuths are clockwise from the North. Positive latitudes are North, positive longitudes are East. Unlike the C++ original, azi2 points in the incoming direction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL