geographiclib

package
v0.0.0-...-1dc08c0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package geographiclib is a wrapper around the GeographicLib library.

Index

Constants

This section is empty.

Variables

View Source
var (
	// WGS84Spheroid represents the default WGS84 ellipsoid.
	WGS84Spheroid = NewSpheroid(6378137, 1/298.257223563)
)

Functions

This section is empty.

Types

type Spheroid

type Spheroid struct {
	Radius       float64
	Flattening   float64
	SphereRadius float64
	// contains filtered or unexported fields
}

Spheroid is an object that can perform geodesic operations on a given spheroid.

func NewSpheroid

func NewSpheroid(radius float64, flattening float64) *Spheroid

NewSpheroid creates a spheroid from a radius and flattening.

func (*Spheroid) AreaAndPerimeter

func (s *Spheroid) AreaAndPerimeter(points []s2.Point) (area float64, perimeter float64)

AreaAndPerimeter computes the area and perimeter of a polygon on a given spheroid. The points must never be duplicated (i.e. do not include the "final" point of a Polygon LinearRing). Area is in meter^2, Perimeter is in meters.

func (*Spheroid) Inverse

func (s *Spheroid) Inverse(a, b s2.LatLng) (s12, az1, az2 float64)

Inverse solves the geodetic inverse problem on the given spheroid (https://en.wikipedia.org/wiki/Geodesy#Geodetic_problems). Returns s12 (distance in meters), az1 (azimuth at point 1) and az2 (azimuth at point 2).

func (*Spheroid) InverseBatch

func (s *Spheroid) InverseBatch(points []s2.Point) float64

InverseBatch computes the sum of the length of the lines represented by the line of points. This is intended for use for LineStrings. LinearRings/Polygons should use "AreaAndPerimeter". Returns the sum of the s12 (distance in meters) units.

func (*Spheroid) Project

func (s *Spheroid) Project(point s2.LatLng, distance float64, azimuth s1.Angle) s2.LatLng

Project returns computes the location of the projected point.

Using the direct geodesic problem from GeographicLib (Karney 2013).

Jump to

Keyboard shortcuts

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