proj

package
v5.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2019 License: BSD-2-Clause Imports: 6 Imported by: 1

Documentation

Overview

Package proj provides an interface to what once was the Cartographic Projections Library PROJ.4 [cartography].

See: https://proj.org

This version works with the newer PROJ library, starting with version 5.

Example usage:

merc, err := proj.NewProj("+proj=merc +ellps=clrk66 +lat_ts=33")
defer merc.Close() // if omitted, this will be called on garbage collection
if err != nil {
    log.Fatal(err)
}

ll, err := proj.NewProj("+proj=latlong")
defer ll.Close()
if err != nil {
    log.Fatal(err)
}

x, y, err := proj.Transform2(ll, merc, proj.DegToRad(-16), proj.DegToRad(20.25))
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%.2f %.2f", x, y)  // should print: -1495284.21 1920596.79

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DegToRad

func DegToRad(deg float64) float64

func Fwd

func Fwd(proj *Proj, long, lat float64) (x, y float64, err error)

Longitude and latitude in degrees

func Inv

func Inv(proj *Proj, x, y float64) (long, lat float64, err error)

Longitude and latitude in degrees

func RadToDeg

func RadToDeg(rad float64) float64

func Transform2

func Transform2(srcpj, dstpj *Proj, x, y float64) (float64, float64, error)

func Transform2lst

func Transform2lst(srcpj, dstpj *Proj, x, y []float64) ([]float64, []float64, error)

func Transform3

func Transform3(srcpj, dstpj *Proj, x, y, z float64) (float64, float64, float64, error)

func Transform3lst

func Transform3lst(srcpj, dstpj *Proj, x, y, z []float64) ([]float64, []float64, []float64, error)

func UTMzone

func UTMzone(lng, lat float64) (xzone int, yzone string, err error)

Get UTM zone for longitude and latitude in degrees.

Reference:

UTM Grid Zones of the World compiled by Alan Morton
http://www.dmap.co.uk/utmworld.htm

Types

type Proj

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

func NewProj

func NewProj(definition string) (*Proj, error)

func (*Proj) Close

func (p *Proj) Close()

Jump to

Keyboard shortcuts

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