proj

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RadToDeg = 180 / math.Pi
	DegToRad = math.Pi / 180
)

Variables

This section is empty.

Functions

func CRSFromEPSG

func CRSFromEPSG(epsg int) (*godal.SpatialRef, error)

CRSFromEPSG initialize a crs from epsg (only once per epsg) DO NOT release the crs (it is kept for further uses)

func CRSFromUserInput

func CRSFromUserInput(input string) (*godal.SpatialRef, int, error)

CRSFromUserInput initialize a crs from epsg, proj4 or Wkt format Return the SRID if known

func CreateLonLatProj

func CreateLonLatProj(crs *godal.SpatialRef, inverse bool) (*godal.Transform, error)

CreateLonLatProj create a CoordinateTransform from/to the geographic lon/lat coordinates

func FlatCoordToXY

func FlatCoordToXY(flat []float64) (x []float64, y []float64)

FlatCoordToXY splits flat into two arrays x, y

func NewPolygonFromExtent added in v0.3.0

func NewPolygonFromExtent(pixToCrs *affine.Affine, width, height int) *geom.Polygon

NewPolygonFromExtent returns the polygon corresponding to the extent

func Srid

func Srid(crs *godal.SpatialRef) int

SRID returns the SRID from the crs or 0 if not found Warning : this function is not reliable...

func XYToFlatCoord

func XYToFlatCoord(x []float64, y []float64) []float64

XYToFlatCoord merge two arrays x, y into one, interleaving coordinates.

Types

type GeographicRing added in v0.3.0

type GeographicRing struct{ Ring }

GeographicShape is a geographic polygon of lon/lat (following geodesic lines)

func NewGeographicRingFromExtent added in v0.3.0

func NewGeographicRingFromExtent(pixToCrs *affine.Affine, width, height int, crs *godal.SpatialRef) (GeographicRing, error)

NewGeographicRingFromExtent creates a ring in geographic coordinates that covers the geometric extent in planar crs

type GeographicShape

type GeographicShape struct{ Shape }

GeographicShape is a geographic polygon of lon/lat (following geodesic lines)

func NewGeographicShapeFromShape

func NewGeographicShapeFromShape(shape Shape, crs *godal.SpatialRef) (GeographicShape, error)

NewGeographicShapeFromShape creates a shape in geographic coordinates that covers the shape in planar crs

type GeometricRing added in v0.3.0

type GeometricRing struct{ Ring }

GeometricShape is a polygon of lon/lat (4326)

type GeometricShape

type GeometricShape struct{ Shape }

GeometricShape is a polygon of lon/lat (4326)

func NewGeometricShapeFromShape

func NewGeometricShapeFromShape(shape Shape, crs *godal.SpatialRef) (g GeometricShape, err error)

NewGeometricShapeFromShape creates a shape in 4326 lon/lat coordinates that covers the shape in planar crs

type Ring added in v0.3.0

type Ring struct {
	geom.LinearRing
}

func NewRingFlat added in v0.3.0

func NewRingFlat(srid int, flatCoords []float64) Ring

NewRingFlat create a new ring

func NewRingFromExtent added in v0.3.0

func NewRingFromExtent(pixToCrs *affine.Affine, width, height, srid int) Ring

NewRingFromExtent returns the ring corresponding to the extent

func (*Ring) Equal added in v0.3.0

func (ring *Ring) Equal(ring2 *Ring) bool

Equal returns true if the shapes have the same SRID and the same FlatCoords

func (*Ring) Scan added in v0.3.0

func (ring *Ring) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (*Ring) Value added in v0.3.0

func (ring *Ring) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Shape

type Shape struct {
	geom.MultiPolygon
}

Shape is a XY-Multipolygon implementing Scan & Value Warning: SRID is not reliable

func NewShape

func NewShape(srid int, mp *geom.MultiPolygon) Shape

NewShape create a new shape

func (*Shape) Equal

func (shape *Shape) Equal(shape2 *Shape) bool

Equal returns true if the shapes have the same SRID and the same FlatCoords

func (Shape) MarshalBinary added in v0.3.0

func (shape Shape) MarshalBinary() ([]byte, error)

func (*Shape) Scan

func (shape *Shape) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (*Shape) UnmarshalBinary added in v0.3.0

func (shape *Shape) UnmarshalBinary(data []byte) error

func (*Shape) Value

func (shape *Shape) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

Jump to

Keyboard shortcuts

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