Documentation
¶
Overview ¶
Package proj provides an interface to PROJ. See https://proj.org.
Index ¶
- Constants
- type Area
- type Bounds
- type Context
- func (c *Context) Destroy()
- func (c *Context) Lock()
- func (c *Context) New(definition string) (*PJ, error)
- func (c *Context) NewCRSToCRS(sourceCRS, targetCRS string, area *Area) (*PJ, error)
- func (c *Context) NewCRSToCRSFromPJ(sourcePJ, targetPJ *PJ, area *Area, options string) (*PJ, error)
- func (c *Context) NewFromArgs(args ...string) (*PJ, error)
- func (c *Context) Unlock()
- type Coord
- type Direction
- type Error
- type PJ
- func (p *PJ) Destroy()
- func (p *PJ) Forward(coord Coord) (Coord, error)
- func (p *PJ) ForwardArray(coords []Coord) error
- func (p *PJ) ForwardBounds(bounds Bounds, densifyPoints int) (Bounds, error)
- func (p *PJ) ForwardFlatCoords(flatCoords []float64, stride, zIndex, mIndex int) error
- func (p *PJ) Geod(a, b Coord) (float64, float64, float64)
- func (p *PJ) GetLastUsedOperation() (*PJ, error)
- func (p *PJ) Info() PJInfo
- func (p *PJ) Inverse(coord Coord) (Coord, error)
- func (p *PJ) InverseArray(coords []Coord) error
- func (p *PJ) InverseBounds(bounds Bounds, densifyPoints int) (Bounds, error)
- func (p *PJ) InverseFlatCoords(flatCoords []float64, stride, zIndex, mIndex int) error
- func (p *PJ) IsCRS() bool
- func (p *PJ) LPDist(a, b Coord) float64
- func (p *PJ) LPZDist(a, b Coord) float64
- func (p *PJ) NormalizeForVisualization() (*PJ, error)
- func (p *PJ) Trans(direction Direction, coord Coord) (Coord, error)
- func (p *PJ) TransArray(direction Direction, coords []Coord) error
- func (p *PJ) TransBounds(direction Direction, bounds Bounds, densifyPoints int) (Bounds, error)
- func (p *PJ) TransFlatCoords(direction Direction, flatCoords []float64, stride, zIndex, mIndex int) error
- func (p *PJ) TransGeneric(direction Direction, x *float64, sx, nx int, y *float64, sy, ny int, ...) error
- type PJInfo
Examples ¶
Constants ¶
const ( VersionMajor = C.PROJ_VERSION_MAJOR VersionMinor = C.PROJ_VERSION_MINOR VersionPatch = C.PROJ_VERSION_PATCH )
Version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Area ¶
type Area struct {
// contains filtered or unexported fields
}
An Area is an area.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
A Context is a context.
func (*Context) Destroy ¶
func (c *Context) Destroy()
Destroy frees all resources associated with c.
func (*Context) NewCRSToCRS ¶
NewCRSToCRS returns a new PJ from sourceCRS to targetCRS and optional area.
func (*Context) NewCRSToCRSFromPJ ¶ added in v10.1.0
func (c *Context) NewCRSToCRSFromPJ(sourcePJ, targetPJ *PJ, area *Area, options string) (*PJ, error)
NewCRSToCRSFromPJ returns a new PJ from two CRSs.
func (*Context) NewFromArgs ¶
NewFromArgs returns a new PJ from args.
type Coord ¶
type Coord [4]float64
A coord is a coordinate.
func (Coord) DegToRad ¶
DegToRad returns a new Coord with the first two elements transformed from degrees to radians.
type PJ ¶
type PJ struct {
// contains filtered or unexported fields
}
A PJ is a projection or a transformation.
func NewCRSToCRS ¶
NewCRSToCRS returns a new PJ from sourceCRS to targetCRS and optional area.
func NewCRSToCRSFromPJ ¶ added in v10.1.0
NewCRSToCRSFromPJ returns a new PJ from two CRSs.
func NewFromArgs ¶ added in v10.1.0
NewFromArgs returns a PJ with the given args.
func (*PJ) Forward ¶
Forward transforms coord in the forward direction.
Example ¶
pj, err := proj.NewCRSToCRS("EPSG:4326", "EPSG:3857", nil) if err != nil { panic(err) } // Convert Zürich's WGS84 latitude/longitude to Web Mercator. zurichEPSG4326 := proj.NewCoord(47.374444, 8.541111, 408, 0) zurichEPSG3857, err := pj.Forward(zurichEPSG4326) if err != nil { panic(err) } fmt.Printf("x=%.6f y=%.6f z=%.6f", zurichEPSG3857.X(), zurichEPSG3857.Y(), zurichEPSG3857.Z())
Output: x=950792.127329 y=6003408.475803 z=408.000000
func (*PJ) ForwardArray ¶
ForwardArray transforms coorsd in the forward direction.
func (*PJ) ForwardBounds ¶
ForwardBounds transforms bounds in the forward direction.
func (*PJ) ForwardFlatCoords ¶
ForwardFlatCoords transforms flatCoords in the forward direction.
func (*PJ) GetLastUsedOperation ¶
GetLastUsedOperation returns the operation used in the last call to Trans.
func (*PJ) InverseArray ¶
InverseArray transforms coorsd in the inverse direction.
func (*PJ) InverseBounds ¶
InverseBounds transforms bounds in the forward direction.
func (*PJ) InverseFlatCoords ¶
InverseFlatCoords transforms flatCoords in the inverse direction.
func (*PJ) LPZDist ¶
LPZDist returns the geodesic distance between a and b in geodetic coordinates, taking height above the ellipsoid into account.q
func (*PJ) NormalizeForVisualization ¶ added in v10.1.0
Returns a new PJ instance whose axis order is the one expected for visualization purposes. If the axis order of its source or target CRS is northing,easting, then an axis swap operation will be inserted. The axis order of geographic CRS will be longitude, latitude [,height], and the one of projected CRS will be easting, northing [, height]
func (*PJ) TransArray ¶
TransArray transforms an array of Coords.