proj

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 6 Imported by: 0

README

This is based on https://github.com/pebbe/proj and modified for static linking

Documentation

Index

Constants

View Source
const (
	Fwd   = Direction(C.PJ_FWD)   // Forward transformation
	Ident = Direction(C.PJ_IDENT) // Do nothing
	Inv   = Direction(C.PJ_INV)   // Inverse transformation
)

Variables

This section is empty.

Functions

func DegToRad

func DegToRad(deg float64) float64

Convert degrees to radians

func RadToDeg

func RadToDeg(rad float64) float64

Convert radians to degrees

Types

type Context

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

func NewContext

func NewContext() *Context

Create a context

func (*Context) Close

func (ctx *Context) Close()

Close a context

func (*Context) Create

func (ctx *Context) Create(definition string) (*PJ, error)

Create a transformation object

type Direction

type Direction C.PJ_DIRECTION

The direction of a transformation

type LibInfo

type LibInfo struct {
	Major      int    // Major version number.
	Minor      int    // Minor version number.
	Patch      int    // Patch level of release.
	Release    string // Release info. Version number and release date, e.g. “Rel. 4.9.3, 15 August 2016”.
	Version    string // Text representation of the full version number, e.g. “4.9.3”.
	Searchpath string // Search path for PROJ. List of directories separated by semicolons (Windows) or colons (non-Windows).
}

func Info

func Info() LibInfo

Get information about the current instance of the PROJ library

type PJ

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

A projection object

func (*PJ) Close

func (p *PJ) Close()

Close a transformation object

func (*PJ) Dist

func (p *PJ) Dist(u1, v1, u2, v2 float64) (float64, error)

Calculate geodesic distance between two points in geodetic coordinates

The calculated distance is between the two points located on the ellipsoid

func (*PJ) Dist3

func (p *PJ) Dist3(u1, v1, w1, u2, v2, w2 float64) (float64, error)

Calculate geodesic distance between two points in geodetic coordinates

Similar to Dist() but also takes the height above the ellipsoid into account

func (*PJ) Info

func (p *PJ) Info() (ProjInfo, error)

Get information about the transformation object

func (*PJ) Trans

func (p *PJ) Trans(direction Direction, u1, v1, w1, t1 float64) (u2, v2, w2, t2 float64, err error)

Transform a single coordinate

func (*PJ) TransSlice

func (p *PJ) TransSlice(direction Direction, u1, v1, w1, t1 []float64) (u2, v2, w2, t2 []float64, err error)

Transform a series of coordinates, where the individual coordinate dimension may be represented by a slice that is either

1. fully populated

2. nil and/or a length of zero, which will be treated as a fully populated slice of zeroes

3. of length one, i.e. a constant, which will be treated as a fully populated slice of that constant value

Note: if an input coordinate is constant, but the output coordinate varies, you need to supply a fully populated slice as input

type ProjInfo

type ProjInfo struct {
	ID          string  // Short ID of the operation the PJ object is based on, that is, what comes afther the +proj= in a proj-string, e.g. “merc”.
	Description string  // Long describes of the operation the PJ object is based on, e.g. “Mercator Cyl, Sph&Ell lat_ts=”.
	Definition  string  // The proj-string that was used to create the PJ object with, e.g. “+proj=merc +lat_0=24 +lon_0=53 +ellps=WGS84”.
	HasInverse  bool    // True if an inverse mapping of the defined operation exists,
	Accuracy    float64 // Expected accuracy of the transformation. -1 if unknown.
}

Jump to

Keyboard shortcuts

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