crs

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 22 Imported by: 0

README

crs

Coverage

go get github.com/wroge/crs@v0.0.1

Go library for coordinate reference systems, map projections, and datum transformations. Supports the majority of EPSG codes (thousands of embedded definitions).

transform, err := crs.Transform(4326, 32632)
if err != nil {
	log.Fatal(err)
}

east, north, h, err := transform(10.0, 50.0, 0)

Axis conventions: geographic lon, lat, h; projected east, north, h; geocentric x, y, z.

Time-dependent transforms

transform, err := crs.TransformAt(9989, 9069, 2010.0) // coordinate epoch (decimal year)

Geodetic grids

Some datum transforms need grid files. Provide them via CDN and/or local sources:

crs.SetGridCDN("https://cdn.proj.org/")                          // download on demand
crs.SetGridCDN("https://cdn.proj.org/", "./.cache") // optional disk cache

crs.RegisterGridDir("/path/to/grids") // search a directory
crs.RegisterGridFS("", embedFS)       // or an fs.FS (e.g. embed.FS)

Lookup order: registered directories, then filesystems, then CDN.

License

Licensed under the MIT License.

Documentation

Overview

Package crs provides coordinate reference systems, map projections, and datum transformations.

Index

Constants

This section is empty.

Variables

View Source
var (
	WGS84 = Datum{
		Name: "wgs84",
		Spheroid: Spheroid{
			Name: "wgs84",
			A:    6378137,
			Fi:   298.257223563,
		},
	}
)
View Source
var World = BoundingBox{
	MinLon: -180,
	MinLat: -90,
	MaxLon: 180,
	MaxLat: 90,
}

Functions

func ParseVerticalGridTIFF

func ParseVerticalGridTIFF(r io.Reader) (*verticalGridData, error)

ParseVerticalGridTIFF reads a PROJ vertical/geoid GeoTIFF (GTG).

func RegisterDatum

func RegisterDatum(name string, d Datum)

func RegisterEPSG

func RegisterEPSG(code int, c CoordinateReferenceSystem)

func RegisterGridDir

func RegisterGridDir(dir string)

func RegisterGridFS

func RegisterGridFS(prefix string, fsys fs.FS)

func RegisterSpheroid

func RegisterSpheroid(name string, s Spheroid)

func SetGridCDN

func SetGridCDN(uri string, cacheDir ...string)

Types

type AlbersEqualArea

type AlbersEqualArea struct {
	Lonf   float64
	Latf   float64
	Sp1    float64
	Sp2    float64
	Eastf  float64
	Northf float64
}

func (AlbersEqualArea) FromGeographic

func (aea AlbersEqualArea) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (AlbersEqualArea) String

func (cs AlbersEqualArea) String() string

func (AlbersEqualArea) ToGeographic

func (aea AlbersEqualArea) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type AmericanPolyconic

type AmericanPolyconic struct {
	Lonf, Latf, Eastf, Northf float64
}

func (AmericanPolyconic) FromGeographic

func (cs AmericanPolyconic) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (AmericanPolyconic) String

func (cs AmericanPolyconic) String() string

func (AmericanPolyconic) ToGeographic

func (cs AmericanPolyconic) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type AzimuthalEquidistant

type AzimuthalEquidistant struct {
	Lonf, Latf, Eastf, Northf float64
}

func (AzimuthalEquidistant) FromGeographic

func (cs AzimuthalEquidistant) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (AzimuthalEquidistant) String

func (cs AzimuthalEquidistant) String() string

func (AzimuthalEquidistant) ToGeographic

func (cs AzimuthalEquidistant) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type BonneSouthOrientated

type BonneSouthOrientated struct {
	Lonf, Latf, Eastf, Northf float64
}

func (BonneSouthOrientated) FromGeographic

func (cs BonneSouthOrientated) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (BonneSouthOrientated) String

func (cs BonneSouthOrientated) String() string

func (BonneSouthOrientated) ToGeographic

func (cs BonneSouthOrientated) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type BoundingBox

type BoundingBox struct {
	MinLon float64
	MinLat float64
	MaxLon float64
	MaxLat float64
}

func (BoundingBox) Area

func (b BoundingBox) Area() float64

func (BoundingBox) Contains

func (b BoundingBox) Contains(lon, lat float64) bool

func (BoundingBox) Intersects

func (b BoundingBox) Intersects(bbox BoundingBox) bool

func (BoundingBox) String

func (b BoundingBox) String() string

type CRS

type CRS interface {
	CoordinateReferenceSystem | int | string
}

type CassiniSoldner

type CassiniSoldner struct {
	Lonf, Latf, Eastf, Northf float64
}

CassiniSoldner is EPSG method 9806 (PROJ +proj=cass).

func (CassiniSoldner) FromGeographic

func (cs CassiniSoldner) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (CassiniSoldner) String

func (cs CassiniSoldner) String() string

func (CassiniSoldner) ToGeographic

func (cs CassiniSoldner) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type ColombiaUrban

type ColombiaUrban struct {
	Lonf, Latf, Eastf, Northf, H0 float64
}

ColombiaUrban is EPSG method 1052 (PROJ +proj=col_urban).

func (ColombiaUrban) FromGeographic

func (cs ColombiaUrban) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (ColombiaUrban) String

func (cs ColombiaUrban) String() string

func (ColombiaUrban) ToGeographic

func (cs ColombiaUrban) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type Conversion

type Conversion interface {
	ToGeographic(s Spheroid, a, b, c float64) (lon, lat, h float64)
	FromGeographic(s Spheroid, lon, lat, h float64) (a, b, c float64)
}

type CoordinateFrameFullMatrix

type CoordinateFrameFullMatrix struct {
	Tx, Ty, Tz, Rx, Ry, Rz, Ds float64
}

func (CoordinateFrameFullMatrix) FromTarget

func (m CoordinateFrameFullMatrix) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

func (CoordinateFrameFullMatrix) String

func (m CoordinateFrameFullMatrix) String() string

func (CoordinateFrameFullMatrix) ToTarget

func (m CoordinateFrameFullMatrix) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

type CoordinateReferenceSystem

type CoordinateReferenceSystem struct {
	Conversion  Conversion
	Datum       Datum
	BoundingBox BoundingBox
}

func Parse

func Parse[C CRS](crs C) (CoordinateReferenceSystem, error)

func (CoordinateReferenceSystem) AtEpoch

AtEpoch evaluates time-dependent datum operations at the given coordinate epoch (decimal year), mirroring Intersects as a pre-Transform datum rewrite.

func (CoordinateReferenceSystem) Intersects

func (CoordinateReferenceSystem) String

func (crs CoordinateReferenceSystem) String() string

func (CoordinateReferenceSystem) TransformTo

type Datum

type Datum struct {
	Name            string
	Spheroid        Spheroid
	Transformations []Transformation
}

func (Datum) AtEpoch

func (d Datum) AtEpoch(epoch float64) Datum

AtEpoch returns a copy of d with time-dependent operations evaluated at epoch (decimal year). TimeDependentPositionVector becomes PositionVector; VelocityGrid with a non-zero Epoch gets Dt = epoch - Epoch.

func (Datum) FromWGS84

func (d Datum) FromWGS84(lon0, lat0, h0 float64) (float64, float64, float64, error)

func (Datum) Intersects

func (d Datum) Intersects(bbox ...BoundingBox) (Datum, error)

func (Datum) String

func (d Datum) String() string

func (Datum) ToWGS84

func (d Datum) ToWGS84(lon, lat, h float64) (float64, float64, float64, error)

func (Datum) TransformTo

func (d Datum) TransformTo(target Datum, lon, lat, h float64) (float64, float64, float64, error)

type EqualEarth

type EqualEarth struct {
	Lonf, Eastf, Northf float64
}

EqualEarth is EPSG method 1078 (PROJ +proj=eqearth). Formulas: IOGP Guidance Note 7-2 §3.4.4.

func (EqualEarth) FromGeographic

func (cs EqualEarth) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (EqualEarth) String

func (cs EqualEarth) String() string

func (EqualEarth) ToGeographic

func (cs EqualEarth) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type EquidistantCylindrical

type EquidistantCylindrical struct {
	Lonf, Latf, Sp1, Eastf, Northf float64
}

func (EquidistantCylindrical) FromGeographic

func (cs EquidistantCylindrical) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (EquidistantCylindrical) String

func (cs EquidistantCylindrical) String() string

func (EquidistantCylindrical) ToGeographic

func (cs EquidistantCylindrical) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type Func

func Transform

func Transform[F, T CRS](from F, to T, intersects ...BoundingBox) (Func, error)

func TransformAt

func TransformAt[F, T CRS](from F, to T, epoch float64, intersects ...BoundingBox) (Func, error)

TransformAt is Transform with both datums evaluated at epoch (decimal year).

func (Func) Round

func (f Func) Round(dec int) Func

func (Func) RoundAxis

func (f Func) RoundAxis(decA, decB, decC int) Func

type Geocentric

type Geocentric struct{}

func (Geocentric) FromGeographic

func (g Geocentric) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (Geocentric) String

func (g Geocentric) String() string

func (Geocentric) ToGeographic

func (g Geocentric) ToGeographic(s Spheroid, x, y, z float64) (float64, float64, float64)

type Geographic

type Geographic struct{}

func (Geographic) FromGeographic

func (g Geographic) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (Geographic) String

func (g Geographic) String() string

func (Geographic) ToGeographic

func (g Geographic) ToGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

type Geographic3dOffset

type Geographic3dOffset struct {
	Lat float64 // arc-seconds
	Lon float64 // arc-seconds
	H   float64 // metres
}

func (Geographic3dOffset) FromTarget

func (o Geographic3dOffset) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

func (Geographic3dOffset) String

func (o Geographic3dOffset) String() string

func (Geographic3dOffset) ToTarget

func (o Geographic3dOffset) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

type GeographicOffset

type GeographicOffset struct {
	Lat float64 // arc-seconds
	Lon float64 // arc-seconds
}

func (GeographicOffset) FromTarget

func (o GeographicOffset) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

func (GeographicOffset) String

func (o GeographicOffset) String() string

func (GeographicOffset) ToTarget

func (o GeographicOffset) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

type GridNotFoundError

type GridNotFoundError struct {
	Err error
}

func (GridNotFoundError) Error

func (e GridNotFoundError) Error() string

func (GridNotFoundError) Unwrap

func (e GridNotFoundError) Unwrap() error

type GuamProjection

type GuamProjection struct {
	Lonf, Latf, Eastf, Northf float64
}

func (GuamProjection) FromGeographic

func (cs GuamProjection) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (GuamProjection) String

func (cs GuamProjection) String() string

func (GuamProjection) ToGeographic

func (cs GuamProjection) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type HorizontalGrid

type HorizontalGrid string

func (HorizontalGrid) FromTarget

func (hg HorizontalGrid) FromTarget(source Spheroid, target Spheroid, lon0 float64, lat0 float64, h0 float64) (float64, float64, float64, error)

func (HorizontalGrid) String

func (hg HorizontalGrid) String() string

func (HorizontalGrid) ToTarget

func (hg HorizontalGrid) ToTarget(source Spheroid, target Spheroid, lon float64, lat float64, h float64) (float64, float64, float64, error)

type HotineObliqueMercatorA

type HotineObliqueMercatorA struct {
	Lonf, Latf, Alpha, Gamma, Scale, Eastf, Northf float64
}

func (HotineObliqueMercatorA) FromGeographic

func (cs HotineObliqueMercatorA) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (HotineObliqueMercatorA) String

func (cs HotineObliqueMercatorA) String() string

func (HotineObliqueMercatorA) ToGeographic

func (cs HotineObliqueMercatorA) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type HyperbolicCassiniSoldner

type HyperbolicCassiniSoldner struct {
	Lonf, Latf, Eastf, Northf float64
}

func (HyperbolicCassiniSoldner) FromGeographic

func (cs HyperbolicCassiniSoldner) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (HyperbolicCassiniSoldner) String

func (cs HyperbolicCassiniSoldner) String() string

func (HyperbolicCassiniSoldner) ToGeographic

func (cs HyperbolicCassiniSoldner) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type Inverse

type Inverse struct {
	Operation Operation
}

func (Inverse) FromTarget

func (i Inverse) FromTarget(source Spheroid, target Spheroid, lon0 float64, lat0 float64, h0 float64) (float64, float64, float64, error)

func (Inverse) String

func (i Inverse) String() string

func (Inverse) ToTarget

func (i Inverse) ToTarget(source Spheroid, target Spheroid, lon float64, lat float64, h float64) (float64, float64, float64, error)

type Krovak

type Krovak struct {
	Lonf   float64
	Latf   float64
	Alpha  float64
	Scale  float64
	Eastf  float64
	Northf float64
}

func (Krovak) FromGeographic

func (k Krovak) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (Krovak) String

func (cs Krovak) String() string

func (Krovak) ToGeographic

func (k Krovak) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type KrovakModified

type KrovakModified struct {
	Lonf, Latf, Alpha, Scale, Eastf, Northf float64
}

func (KrovakModified) FromGeographic

func (cs KrovakModified) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (KrovakModified) String

func (cs KrovakModified) String() string

func (KrovakModified) ToGeographic

func (cs KrovakModified) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LabordeObliqueMercator

type LabordeObliqueMercator struct {
	Lonf, Latf, Alpha, Scale, Eastf, Northf float64
}

func (LabordeObliqueMercator) FromGeographic

func (cs LabordeObliqueMercator) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LabordeObliqueMercator) String

func (cs LabordeObliqueMercator) String() string

func (LabordeObliqueMercator) ToGeographic

func (cs LabordeObliqueMercator) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertAzimuthalEqualArea

type LambertAzimuthalEqualArea struct {
	Lonf   float64
	Latf   float64
	Eastf  float64
	Northf float64
}

func (LambertAzimuthalEqualArea) FromGeographic

func (laea LambertAzimuthalEqualArea) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertAzimuthalEqualArea) String

func (cs LambertAzimuthalEqualArea) String() string

func (LambertAzimuthalEqualArea) ToGeographic

func (laea LambertAzimuthalEqualArea) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertAzimuthalEqualAreaSpherical

type LambertAzimuthalEqualAreaSpherical struct {
	Lonf, Latf, Eastf, Northf float64
}

func (LambertAzimuthalEqualAreaSpherical) FromGeographic

func (cs LambertAzimuthalEqualAreaSpherical) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertAzimuthalEqualAreaSpherical) String

func (LambertAzimuthalEqualAreaSpherical) ToGeographic

func (cs LambertAzimuthalEqualAreaSpherical) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertConformalConic

type LambertConformalConic struct {
	Lonf   float64
	Latf   float64
	Scale  float64
	Eastf  float64
	Northf float64
}

func (LambertConformalConic) FromGeographic

func (lcc LambertConformalConic) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertConformalConic) String

func (cs LambertConformalConic) String() string

func (LambertConformalConic) ToGeographic

func (lcc LambertConformalConic) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertConformalConic1SPVariantB

type LambertConformalConic1SPVariantB struct {
	Lonf, Lat0, Latf, Scale, Eastf, Northf float64
}

LambertConformalConic1SPVariantB is EPSG method 1102. Same cone as LCC 1SP at Lat0 (natural origin); FE/FN apply at Latf (false origin).

func (LambertConformalConic1SPVariantB) FromGeographic

func (cs LambertConformalConic1SPVariantB) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertConformalConic1SPVariantB) String

func (LambertConformalConic1SPVariantB) ToGeographic

func (cs LambertConformalConic1SPVariantB) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertConformalConic2SP

type LambertConformalConic2SP struct {
	Lonf   float64
	Latf   float64
	Sp1    float64
	Sp2    float64
	Eastf  float64
	Northf float64
}

func (LambertConformalConic2SP) FromGeographic

func (lcc LambertConformalConic2SP) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertConformalConic2SP) String

func (cs LambertConformalConic2SP) String() string

func (LambertConformalConic2SP) ToGeographic

func (lcc LambertConformalConic2SP) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertConformalConic2SPBelgium

type LambertConformalConic2SPBelgium struct {
	Lonf, Latf, Sp1, Sp2, Eastf, Northf float64
}

func (LambertConformalConic2SPBelgium) FromGeographic

func (cs LambertConformalConic2SPBelgium) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertConformalConic2SPBelgium) String

func (LambertConformalConic2SPBelgium) ToGeographic

func (cs LambertConformalConic2SPBelgium) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertConformalConic2SPMichigan

type LambertConformalConic2SPMichigan struct {
	Lonf, Latf, Sp1, Sp2, Eastf, Northf float64
}

func (LambertConformalConic2SPMichigan) FromGeographic

func (cs LambertConformalConic2SPMichigan) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertConformalConic2SPMichigan) String

func (LambertConformalConic2SPMichigan) ToGeographic

func (cs LambertConformalConic2SPMichigan) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertConicNearConformal

type LambertConicNearConformal struct {
	Lonf, Latf, Scale, Eastf, Northf float64
}

func (LambertConicNearConformal) FromGeographic

func (cs LambertConicNearConformal) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertConicNearConformal) String

func (cs LambertConicNearConformal) String() string

func (LambertConicNearConformal) ToGeographic

func (cs LambertConicNearConformal) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertCylindricalEqualArea

type LambertCylindricalEqualArea struct {
	Lonf, Sp1, Eastf, Northf float64
}

func (LambertCylindricalEqualArea) FromGeographic

func (cs LambertCylindricalEqualArea) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertCylindricalEqualArea) String

func (cs LambertCylindricalEqualArea) String() string

func (LambertCylindricalEqualArea) ToGeographic

func (cs LambertCylindricalEqualArea) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LambertCylindricalEqualAreaSpherical

type LambertCylindricalEqualAreaSpherical struct {
	Lonf, Sp1, Eastf, Northf float64
}

func (LambertCylindricalEqualAreaSpherical) FromGeographic

func (cs LambertCylindricalEqualAreaSpherical) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LambertCylindricalEqualAreaSpherical) String

func (LambertCylindricalEqualAreaSpherical) ToGeographic

func (cs LambertCylindricalEqualAreaSpherical) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LocalOrthographic

type LocalOrthographic struct {
	Lonf, Latf, Azimuth, Scale, Eastf, Northf float64
}

func (LocalOrthographic) FromGeographic

func (cs LocalOrthographic) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (LocalOrthographic) String

func (cs LocalOrthographic) String() string

func (LocalOrthographic) ToGeographic

func (cs LocalOrthographic) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type LongitudeRotation

type LongitudeRotation struct {
	Lon float64
}

func (LongitudeRotation) FromTarget

func (l LongitudeRotation) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

func (LongitudeRotation) String

func (l LongitudeRotation) String() string

func (LongitudeRotation) ToTarget

func (l LongitudeRotation) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

type MercatorA

type MercatorA struct {
	Lonf, Latf, Scale, Eastf, Northf float64
}

MercatorA is EPSG method 9804 (PROJ +proj=merc with k / 1SP). Latf is unused in the formulas (natural origin is on the equator).

func (MercatorA) FromGeographic

func (cs MercatorA) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (MercatorA) String

func (cs MercatorA) String() string

func (MercatorA) ToGeographic

func (cs MercatorA) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type MercatorB

type MercatorB struct {
	Lonf, Sp1, Eastf, Northf float64
}

MercatorB is EPSG method 9805 (PROJ +proj=merc with lat_ts / 2SP). Sp1 is the latitude of the first standard parallel; k0 is derived from it.

func (MercatorB) FromGeographic

func (cs MercatorB) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (MercatorB) String

func (cs MercatorB) String() string

func (MercatorB) ToGeographic

func (cs MercatorB) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type ModifiedAzimuthalEquidistant

type ModifiedAzimuthalEquidistant struct {
	Lonf, Latf, Eastf, Northf float64
}

func (ModifiedAzimuthalEquidistant) FromGeographic

func (cs ModifiedAzimuthalEquidistant) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (ModifiedAzimuthalEquidistant) String

func (ModifiedAzimuthalEquidistant) ToGeographic

func (cs ModifiedAzimuthalEquidistant) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type MolodenskyBadekas

type MolodenskyBadekas struct {
	Tx, Ty, Tz, Rx, Ry, Rz, Ds float64
	Px, Py, Pz                 float64
}

func (MolodenskyBadekas) FromTarget

func (m MolodenskyBadekas) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

func (MolodenskyBadekas) String

func (m MolodenskyBadekas) String() string

func (MolodenskyBadekas) ToTarget

func (m MolodenskyBadekas) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

type NewZealandMapGrid

type NewZealandMapGrid struct {
	Lonf, Latf, Eastf, Northf float64
}

func (NewZealandMapGrid) FromGeographic

func (cs NewZealandMapGrid) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (NewZealandMapGrid) String

func (cs NewZealandMapGrid) String() string

func (NewZealandMapGrid) ToGeographic

func (cs NewZealandMapGrid) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type ObliqueStereographic

type ObliqueStereographic struct {
	Lonf, Latf, Scale, Eastf, Northf float64
}

func (ObliqueStereographic) FromGeographic

func (cs ObliqueStereographic) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (ObliqueStereographic) String

func (cs ObliqueStereographic) String() string

func (ObliqueStereographic) ToGeographic

func (cs ObliqueStereographic) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type Operation

type Operation interface {
	ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)
	FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)
}

type OutOfBoundsError

type OutOfBoundsError struct {
	Err error
}

func (OutOfBoundsError) Error

func (e OutOfBoundsError) Error() string

func (OutOfBoundsError) Unwrap

func (e OutOfBoundsError) Unwrap() error

type PolarStereographicA

type PolarStereographicA struct {
	Lonf, Latf, Scale, Eastf, Northf float64
}

func (PolarStereographicA) FromGeographic

func (cs PolarStereographicA) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (PolarStereographicA) String

func (cs PolarStereographicA) String() string

func (PolarStereographicA) ToGeographic

func (cs PolarStereographicA) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type PolarStereographicB

type PolarStereographicB struct {
	Lonf, Latf, Eastf, Northf float64
}

func (PolarStereographicB) FromGeographic

func (cs PolarStereographicB) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (PolarStereographicB) String

func (cs PolarStereographicB) String() string

func (PolarStereographicB) ToGeographic

func (cs PolarStereographicB) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type PolarStereographicC

type PolarStereographicC struct {
	Lonf, Latf, Eastf, Northf float64
}

PolarStereographicC is EPSG method 9830. Latf is the standard parallel (latitude of false origin); FE/FN apply there, not at the pole.

func (PolarStereographicC) FromGeographic

func (cs PolarStereographicC) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (PolarStereographicC) String

func (cs PolarStereographicC) String() string

func (PolarStereographicC) ToGeographic

func (cs PolarStereographicC) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type PositionVector

type PositionVector struct {
	Tx float64
	Ty float64
	Tz float64
	Rx float64
	Ry float64
	Rz float64
	Ds float64
}

func (PositionVector) FromTarget

func (pv PositionVector) FromTarget(source Spheroid, target Spheroid, lon0 float64, lat0 float64, h0 float64) (float64, float64, float64, error)

func (PositionVector) String

func (pc PositionVector) String() string

func (PositionVector) ToTarget

func (pv PositionVector) ToTarget(source Spheroid, target Spheroid, lon float64, lat float64, h float64) (float64, float64, float64, error)

type Spheroid

type Spheroid struct {
	Name string
	A    float64
	Fi   float64
}

func (Spheroid) A2

func (s Spheroid) A2() float64

func (Spheroid) B

func (s Spheroid) B() float64

func (Spheroid) E

func (s Spheroid) E() float64

func (Spheroid) E2

func (s Spheroid) E2() float64

func (Spheroid) E4

func (s Spheroid) E4() float64

func (Spheroid) E6

func (s Spheroid) E6() float64

func (Spheroid) Ei

func (s Spheroid) Ei() float64

func (Spheroid) Ei2

func (s Spheroid) Ei2() float64

func (Spheroid) Ei3

func (s Spheroid) Ei3() float64

func (Spheroid) Ei4

func (s Spheroid) Ei4() float64

func (Spheroid) F

func (s Spheroid) F() float64

func (Spheroid) F2

func (s Spheroid) F2() float64

func (Spheroid) GeocentricToGeographic

func (s Spheroid) GeocentricToGeographic(x, y, z float64) (lon, lat, h float64)

func (Spheroid) GeographicToGeocentric

func (s Spheroid) GeographicToGeocentric(lon, lat, h float64) (x, y, z float64)

func (Spheroid) String

func (s Spheroid) String() string

type SwissObliqueMercator

type SwissObliqueMercator struct {
	Lonf   float64
	Latf   float64
	Scale  float64
	Eastf  float64
	Northf float64
	Alpha  float64
	Gamma  float64
}

SwissObliqueMercator is EPSG method 9814 (PROJ +proj=somerc). Alpha/Gamma are retained for EPSG parameter round-trip; the classic Swiss formulas assume azimuth = rectified grid angle = 90°.

func (SwissObliqueMercator) FromGeographic

func (som SwissObliqueMercator) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (SwissObliqueMercator) String

func (cs SwissObliqueMercator) String() string

func (SwissObliqueMercator) ToGeographic

func (som SwissObliqueMercator) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type TimeDependentPositionVector

type TimeDependentPositionVector struct {
	Tx, Ty, Tz, Rx, Ry, Rz, Ds                             float64
	TxRate, TyRate, TzRate, RxRate, RyRate, RzRate, DsRate float64
	ReferenceEpoch                                         float64
}

func (TimeDependentPositionVector) FromTarget

func (t TimeDependentPositionVector) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

FromTarget evaluates Helmert parameters at ReferenceEpoch (dt=0). Use Datum.AtEpoch / TransformAt so rates apply at a coordinate epoch.

func (TimeDependentPositionVector) String

func (TimeDependentPositionVector) ToTarget

func (t TimeDependentPositionVector) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

ToTarget evaluates Helmert parameters at ReferenceEpoch (dt=0). Use Datum.AtEpoch / TransformAt so rates apply at a coordinate epoch.

type TimeSpecificPositionVector

type TimeSpecificPositionVector struct {
	Tx, Ty, Tz, Rx, Ry, Rz, Ds float64
	TransformationEpoch        float64
}

func (TimeSpecificPositionVector) FromTarget

func (t TimeSpecificPositionVector) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

func (TimeSpecificPositionVector) String

func (TimeSpecificPositionVector) ToTarget

func (t TimeSpecificPositionVector) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

type Transformation

type Transformation struct {
	Target      *Datum
	Accuracy    float64
	BoundingBox BoundingBox
	Operation   Operation
}

func (Transformation) FromDatum

func (t Transformation) FromDatum(owner Spheroid, lon, lat, h float64) (float64, float64, float64, error)

func (Transformation) FromWGS84

func (t Transformation) FromWGS84(source Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

func (Transformation) String

func (t Transformation) String() string

func (Transformation) ToDatum

func (t Transformation) ToDatum(source Spheroid, lon, lat, h float64) (float64, float64, float64, error)

func (Transformation) ToWGS84

func (t Transformation) ToWGS84(source Spheroid, lon, lat, h float64) (float64, float64, float64, error)

type TransverseMercator

type TransverseMercator struct {
	Lonf      float64
	Latf      float64
	Scale     float64
	Eastf     float64
	Northf    float64
	ZoneWidth float64
}

func (TransverseMercator) FromGeographic

func (cs TransverseMercator) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (TransverseMercator) String

func (cs TransverseMercator) String() string

func (TransverseMercator) ToGeographic

func (cs TransverseMercator) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

type TunisiaMiningGrid

type TunisiaMiningGrid struct {
	Lonf, Latf, Eastf, Northf float64
}

func (TunisiaMiningGrid) FromGeographic

func (cs TunisiaMiningGrid) FromGeographic(_ Spheroid, lon, lat, h float64) (float64, float64, float64)

func (TunisiaMiningGrid) String

func (cs TunisiaMiningGrid) String() string

func (TunisiaMiningGrid) ToGeographic

func (cs TunisiaMiningGrid) ToGeographic(_ Spheroid, east, north, h float64) (float64, float64, float64)

type UnsupportedError

type UnsupportedError struct {
	Err error
}

func (UnsupportedError) Error

func (e UnsupportedError) Error() string

func (UnsupportedError) Unwrap

func (e UnsupportedError) Unwrap() error

type VelocityGrid

type VelocityGrid struct {
	Grid  string
	Dt    float64
	Epoch float64
}

VelocityGrid is PROJ +proj=deformation with a fixed timespan dt (years). Grid bands are east/north/up velocities in mm/year (GTG TYPE=VELOCITY). When Epoch != 0, Datum.AtEpoch sets Dt = epoch - Epoch.

func (VelocityGrid) FromTarget

func (v VelocityGrid) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

FromTarget implements Operation: apply −dt · V.

func (VelocityGrid) String

func (v VelocityGrid) String() string

func (VelocityGrid) ToTarget

func (v VelocityGrid) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

ToTarget implements Operation: apply +dt · V in geocentric space.

type VerticalGrid

type VerticalGrid string

VerticalGrid is a geoid / vertical undulation grid (PROJ vgridshift / GTG). Grid samples are the geographic→vertical offset δ (metres): H = h + δ. For a classical geoid undulation N (H = h − N), the grid stores δ = −N.

func (VerticalGrid) FromTarget

func (vg VerticalGrid) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

FromTarget implements Operation: ellipsoidal → orthometric (H = h + δ).

func (VerticalGrid) String

func (vg VerticalGrid) String() string

func (VerticalGrid) ToTarget

func (vg VerticalGrid) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

ToTarget implements Operation: orthometric → ellipsoidal (h = H − δ).

type VerticalOffset

type VerticalOffset struct {
	Dh float64
}

func (VerticalOffset) FromTarget

func (o VerticalOffset) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

func (VerticalOffset) String

func (o VerticalOffset) String() string

func (VerticalOffset) ToTarget

func (o VerticalOffset) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

type VerticalOffsetAndSlope

type VerticalOffsetAndSlope struct {
	Lat0, Lon0         float64
	Dh                 float64
	SlopeLat, SlopeLon float64 // arc-seconds
}

func (VerticalOffsetAndSlope) FromTarget

func (o VerticalOffsetAndSlope) FromTarget(source, target Spheroid, lon0, lat0, h0 float64) (float64, float64, float64, error)

FromTarget implements Operation.

func (VerticalOffsetAndSlope) String

func (o VerticalOffsetAndSlope) String() string

func (VerticalOffsetAndSlope) ToTarget

func (o VerticalOffsetAndSlope) ToTarget(source, target Spheroid, lon, lat, h float64) (float64, float64, float64, error)

ToTarget implements Operation.

type WebMercator

type WebMercator struct {
	Lonf   float64
	Latf   float64
	Scale  float64
	Eastf  float64
	Northf float64
}

func (WebMercator) FromGeographic

func (cs WebMercator) FromGeographic(s Spheroid, lon, lat, h float64) (float64, float64, float64)

func (WebMercator) String

func (cs WebMercator) String() string

func (WebMercator) ToGeographic

func (cs WebMercator) ToGeographic(s Spheroid, east, north, h float64) (float64, float64, float64)

Jump to

Keyboard shortcuts

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