proj

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

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

Go to latest
Published: Dec 23, 2015 License: MIT Imports: 7 Imported by: 0

README

Proj

Package proj is a Go wrapper around the Proj4 C library.

It provides coordinate reference system transformation functionalities.

The original library (MIT licensed) can be found at https://github.com/OSGeo/proj.4

Install

go get github.com/xeonx/proj4

Docs

http://godoc.org/github.com/xeonx/proj4

Tests

go test is used for testing.

License

This code is licensed under the MIT license. See LICENSE.

Files from Proj4 are Copyright (c) 2000, Frank Warmerdam and licensed under a MIT/X11 style license.

Documentation

Overview

Package proj is a Go wrapper around the Proj4 C library.

It provides coordinate reference system definition and transformation functionalities.

No shared library is required at runtime as the C code is ntegrated in the package. The PROJ_LIB environment variable must be set or the SetFinder function must be called in order to identify the location of the share folder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFinder

func SetFinder(paths []string)

SetFinder add one or more directories to search for proj definition files. Multiple calls overwrite the previous search paths.

func TransformPoints

func TransformPoints(src *Proj, dst *Proj, points []geom.Point) error

TransformPoints transforms the points inplace from the source coordinate system to the destination coordinate system.

func TransformRaw

func TransformRaw(src *Proj, dst *Proj, xs []float64, ys []float64, zs []float64) error

TransformRaw transforms the x/y/z points from the source coordinate system to the destination coordinate system. zs can be nil or must have the same length as xs and ys.

Types

type Proj

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

Proj represents a coordinate reference system. It is not safe for concurent use

func InitPlus

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

InitPlus initializes a new projection from a proj4 plus string (eg. "+init=epsg:4326" )

func (*Proj) Close

func (p *Proj) Close()

Close deallocates the projection immediately. Otherwise, it will be deallocated on garbage collection.

func (*Proj) GetDef

func (p *Proj) GetDef() string

GetDef returns an initialization string suitable for use with InitPlus

func (*Proj) IsGeoCent

func (p *Proj) IsGeoCent() bool

IsGeoCent returns whether the projection is geocentric

func (*Proj) IsLatLong

func (p *Proj) IsLatLong() bool

IsLatLong returns whether the projection is geographic

type Transformation

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

Transformation projects coordinates from a source to a destination

func NewTransformation

func NewTransformation(src, dst *Proj) (Transformation, error)

NewTransformation initializes a new transformation with src and dst

func (Transformation) TransformPoints

func (t Transformation) TransformPoints(points []geom.Point) error

TransformPoints transforms the points inplace from the source coordinate system to the destination coordinate system.

func (Transformation) TransformRaw

func (t Transformation) TransformRaw(xs, ys, zs []float64) error

TransformRaw transforms the x/y/z points from the source coordinate system to the destination coordinate system. zs can be nil or must have the same length as xs and ys.

Jump to

Keyboard shortcuts

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