cockroach: Index | Files

package geographiclib

import ""

Package geographiclib is a wrapper around the GeographicLib library.


Package Files



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

type Spheroid Uses

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 Uses

func NewSpheroid(radius float64, flattening float64) *Spheroid

NewSpheroid creates a spheroid from a radius and flattening.

func (*Spheroid) AreaAndPerimeter Uses

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 Uses

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

Inverse solves the geodetic inverse problem on the given spheroid ( Returns s12 (distance in meters), az1 (azimuth at point 1) and az2 (azimuth at point 2).

func (*Spheroid) InverseBatch Uses

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 Uses

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).

Package geographiclib imports 4 packages (graph) and is imported by 7 packages. Updated 2020-08-12. Refresh now. Tools for package owners.