geoprojbase

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package geoprojbase is a minimal dependency package that contains basic metadata and data structures for SRIDs and their CRS transformations.

Index

Constants

This section is empty.

Variables

View Source
var ErrProjectionNotFound error = errors.Newf("projection not found")

ErrProjectionNotFound indicates a project was not found.

View Source
var MakeSpheroid = func(radius, flattening float64) (Spheroid, error) {
	return nil, errors.AssertionFailedf("MakeSpheroid not initialised")
}

MakeSpheroid is an injectable function which creates a spheroid. If you hit the assertion here, you may want to blank import geographic lib, e.g. _ "github.com/cockroachdb/cockroachdb-parser/pkg/geo/geographiclib".

Functions

This section is empty.

Types

type Bounds

type Bounds struct {
	MinX float64
	MaxX float64
	MinY float64
	MaxY float64
}

Bounds represents the projected or lat/lng bounds.

type Proj4Text

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

Proj4Text is the text representation of a PROJ4 transformation.

func MakeProj4Text

func MakeProj4Text(str string) Proj4Text

MakeProj4Text returns a new Proj4Text with spec based on the given string.

func (*Proj4Text) Bytes

func (p *Proj4Text) Bytes() []byte

Bytes returns the raw bytes for the given proj text.

func (*Proj4Text) Equal

func (p *Proj4Text) Equal(o Proj4Text) bool

Equal returns whether the two Proj4Texts are equal.

func (*Proj4Text) String

func (p *Proj4Text) String() string

String returns the string representation of the given proj text.

type ProjInfo

type ProjInfo struct {
	// SRID is the SRID of the projection.
	SRID geopb.SRID
	// AuthName is the authority who has provided this projection (e.g. ESRI, EPSG).
	AuthName string
	// AuthSRID is the SRID the given AuthName interprets the SRID as.
	AuthSRID int
	// SRText is the WKT representation of the projection.
	SRText string
	// Proj4Text is the PROJ4 text representation of the projection.
	Proj4Text Proj4Text
	// Bounds defines the bounds (projected or lat/lng) of the given coordinate system.
	Bounds Bounds

	// IsLatLng stores whether the projection is a LatLng based projection (denormalized from above)
	IsLatLng bool
	// The spheroid represented by the SRID.
	Spheroid Spheroid
}

ProjInfo is a struct containing metadata related to a given SRID.

func AllProjections

func AllProjections() []ProjInfo

AllProjections returns a sorted list of all projections.

func MustProjection

func MustProjection(srid geopb.SRID) ProjInfo

MustProjection returns the ProjInfo for the given SRID, panicking if the projection does not exist.

func Projection

func Projection(srid geopb.SRID) (ProjInfo, error)

Projection returns the ProjInfo for the given SRID, as well as an error if the projection does not exist.

type Spheroid

type Spheroid interface {
	Inverse(a, b s2.LatLng) (s12, az1, az2 float64)
	InverseBatch(points []s2.Point) float64
	AreaAndPerimeter(points []s2.Point) (area float64, perimeter float64)
	Project(point s2.LatLng, distance float64, azimuth s1.Angle) s2.LatLng
	Radius() float64
	Flattening() float64
	SphereRadius() float64
}

Spheroid represents a spheroid object.

Directories

Path Synopsis
Package embeddedproj defines the format used to embed static projection data in the Cockroach binary.
Package embeddedproj defines the format used to embed static projection data in the Cockroach binary.

Jump to

Keyboard shortcuts

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