proj

package
v8.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRSToCRS

func CRSToCRS(source, target string, transform func(Projection)) error

CRSToCRS facilitates transformations between two coordinate reference systems.

Example
package main

import (
	"fmt"

	"github.com/everystreet/go-proj/v8/proj"
)

func main() {
	coord := proj.XYZ{
		X: 2,
		Y: 49,
		Z: 10,
	}

	if err := proj.CRSToCRS("+proj=latlong", "EPSG:3857", func(pj proj.Projection) {
		proj.TransformForward(pj, &coord)
		// transform more coordinates
	}); err != nil {
		panic(err)
	}

	fmt.Printf("%.2f %.2f %.2f", coord.X, coord.Y, coord.Z)
}
Output:

222638.98 6274861.39 10.00

func TransformForward

func TransformForward(pj Projection, coord Coordinate)

TransformForward performs a forward transformation of the supplied coordinate.

func TransformInverse

func TransformInverse(pj Projection, coord Coordinate)

TransformInverse performs an inverse transformation of the supplied coordinate.

Types

type Area

type Area struct {
	BottomLeft s2.LatLng
	TopRight   s2.LatLng
}

Area of use for a particular CRS.

type CRS

type CRS string

CRS is a coordinate reference system definition.

func (CRS) Area

func (c CRS) Area() (*Area, bool, error)

Area returns the area of use for the CRS, or false if no such area is defined.

func (CRS) String

func (c CRS) String() string

String returns the lower-cased CRS definition. If the definition is a proj-string, the "+type=crs" option if appended if not present.

type Coordinate

type Coordinate interface {
	PutCoordinate(*cproj.PJ_COORD)
	FromCoordinate(cproj.PJ_COORD)
}

Coordinate wraps functions that allow communication with the cproj package.

type LP

type LP s2.LatLng

LP is a geodetic coordinate expressed in radians.

func (*LP) FromCoordinate

func (c *LP) FromCoordinate(coord cproj.PJ_COORD)

FromCoordinate updates c with the values in coord.

func (LP) PutCoordinate

func (c LP) PutCoordinate(coord *cproj.PJ_COORD)

PutCoordinate updates coord with the values in c.

type LPZ

type LPZ struct {
	LP
	Z float64
}

LPZ is a geodetic coordinate expressed in radians, with a vertical component.

func (*LPZ) FromCoordinate

func (c *LPZ) FromCoordinate(coord cproj.PJ_COORD)

FromCoordinate updates c with the values in coord.

func (LPZ) PutCoordinate

func (c LPZ) PutCoordinate(coord *cproj.PJ_COORD)

PutCoordinate updates coord with the values in c.

type LPZT

type LPZT struct {
	LPZ
	T float64
}

LPZT is a geodetic coordinate expressed in radians, with vertical and time components.

func (*LPZT) FromCoordinate

func (c *LPZT) FromCoordinate(coord cproj.PJ_COORD)

FromCoordinate updates c with the values in coord.

func (LPZT) PutCoordinate

func (c LPZT) PutCoordinate(coord *cproj.PJ_COORD)

PutCoordinate updates coord with the values in c.

type Projection

type Projection *cproj.PJ

Projection context.

type XY

type XY r2.Point

XY is a 2D cartesian coordinate.

func (*XY) FromCoordinate

func (c *XY) FromCoordinate(coord cproj.PJ_COORD)

FromCoordinate updates c with the values in coord.

func (XY) PutCoordinate

func (c XY) PutCoordinate(coord *cproj.PJ_COORD)

PutCoordinate updates coord with the values in c.

type XYZ

type XYZ r3.Vector

XYZ is a 3D cartesian coordinate.

func (*XYZ) FromCoordinate

func (c *XYZ) FromCoordinate(coord cproj.PJ_COORD)

FromCoordinate updates c with the values in coord.

func (XYZ) PutCoordinate

func (c XYZ) PutCoordinate(coord *cproj.PJ_COORD)

PutCoordinate updates coord with the values in c.

type XYZT

type XYZT struct {
	XYZ
	T float64
}

XYZT is a 3D cartesian coordinate with a time component.

func (*XYZT) FromCoordinate

func (c *XYZT) FromCoordinate(coord cproj.PJ_COORD)

FromCoordinate updates c with the values in coord.

func (XYZT) PutCoordinate

func (c XYZT) PutCoordinate(coord *cproj.PJ_COORD)

PutCoordinate updates coord with the values in c.

Jump to

Keyboard shortcuts

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