elevation

package module
v0.0.0-...-b2ab2e0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: MIT Imports: 15 Imported by: 1

README

go-elevation

PkgGoDev

Package elevation reads elevation data from GeoTIFF files.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterpolateBilinear

func InterpolateBilinear(ctx context.Context, raster Raster, coords [][]float64) ([]float64, error)

Types

type Coord

type Coord struct {
	X int
	Y int
}

A Coord is a coordinate.

type EUDEMElevationService

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

func NewEUDEMElevationService

func NewEUDEMElevationService(fsys fs.FS, options ...GeoTIFFTileSetOption) (*EUDEMElevationService, error)

func (*EUDEMElevationService) Elevation

func (s *EUDEMElevationService) Elevation(ctx context.Context, coords [][]float64) ([]float64, error)

func (*EUDEMElevationService) Elevation4326

func (s *EUDEMElevationService) Elevation4326(ctx context.Context, coords4326 [][]float64) ([]float64, error)

type GeoKey

type GeoKey uint16
const (
	GeoKeyGTModelType  GeoKey = 1024
	GeoKeyGTRasterType GeoKey = 1025
	GeoKeyGTCitation   GeoKey = 1026

	GeoKeyGeodeticCRS            GeoKey = 2048
	GeoKeyGeogCitation           GeoKey = 2049
	GeoKeyGeodeticDatum          GeoKey = 2050
	GeoKeyPrimeMeridian          GeoKey = 2051
	GeoKeyLinearUnits            GeoKey = 2052
	GeoKeyGeogLinearUnitSize     GeoKey = 2053
	GeoKeyAngularUnits           GeoKey = 2054
	GeoKeyGeogAngularUnitSize    GeoKey = 2055
	GeoKeyEllipsoid              GeoKey = 2056
	GeoKeyEllipsoidSemiMajorAxis GeoKey = 2057
	GeoKeyEllipsoidSemiMinorAxis GeoKey = 2058
	GeoKeyEllipsoidInvFlattening GeoKey = 2059
	GeoKeyAzimuthUnits           GeoKey = 2060
	GeoKeyPrimeMeridianLongitude GeoKey = 2061

	GeoKeyProjectedCRS                                 GeoKey = 3072
	GeoKeyPCSCitation                                  GeoKey = 3073
	GeoKeyProjection                                   GeoKey = 3074
	GeoKeyProjMethod                                   GeoKey = 3075
	GeoKeyLinearUnits2                                 GeoKey = 3076
	GeoKeyProjectedLinearUnitSize                      GeoKey = 3077
	GeoKeyStandardParallel1GeoKeyProjAngularParameters GeoKey = 3078
	GeoKeyStandardParallel2GeoKeyProjAngularParameters GeoKey = 3079
	GeoKeyNaturalOriginLongitudeProjAngularParameters  GeoKey = 3080
	GeoKeyNaturalOriginLatitudeProjAngularParameters   GeoKey = 3081
	GeoKeyFalseEastingProjLinearParameters             GeoKey = 3082
	GeoKeyFalseNorthingProjLinearParameters            GeoKey = 3083
	GeoKeyFalseOriginLongitudeProjAngularParameters    GeoKey = 3084
	GeoKeyFalseOriginLatitudeProjAngularParameters     GeoKey = 3085
	GeoKeyFalseOriginEastingProjLinearParameters       GeoKey = 3086
	GeoKeyFalseOriginNorthingProjLinearParameters      GeoKey = 3087
	GeoKeyCenterLongitudeProjAngularParameters         GeoKey = 3088
	GeoKeyCenterLatitudeProjAngularParameters          GeoKey = 3089
	GeoKeyProjectionCenterEastingProjLinearParameters  GeoKey = 3090
	GeoKeyProjectionCenterNorthingProjLinearParameters GeoKey = 3091
	GeoKeyScaleAtNaturalOriginProjScalarParameters     GeoKey = 3092
	GeoKeyScaleAtCenterProjScalarParameters            GeoKey = 3093
	GeoKeyProjAzimuthAngle                             GeoKey = 3094
	GeoKeyStraightVerticalPoleProjAngularParameters    GeoKey = 3095

	GeoKeyVertical         GeoKey = 4096
	GeoKeyVerticalCitation GeoKey = 4097
	GeoKeyVerticalDatum    GeoKey = 4098
	GeoKeyVerticalUnits    GeoKey = 4099
)

type GeoTIFFTile

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

A GeoTIFFTile is an open GeoTIFF file.

func NewGeoTIFFTile

func NewGeoTIFFTile(fsys fs.FS, filename string, options ...GeoTIFFTileOption) (*GeoTIFFTile, error)

NewGeoTIFFTile returns a new GeoTIFFTile.

func (*GeoTIFFTile) Close

func (f *GeoTIFFTile) Close() error

func (*GeoTIFFTile) Sample

func (f *GeoTIFFTile) Sample(ctx context.Context, coord Coord) (float64, error)

Sample returns a single sample from f.

func (*GeoTIFFTile) Samples

func (f *GeoTIFFTile) Samples(ctx context.Context, coords []Coord) ([]float64, error)

Samples returns multiple samples from f. It is significantly faster than calling [Sample] for each coordinate.

type GeoTIFFTileOption

type GeoTIFFTileOption func(*GeoTIFFTile)

func WithTileCacheSize

func WithTileCacheSize(tileCacheSize int) GeoTIFFTileOption

type GeoTIFFTileSet

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

A GeoTIFFTileSet is a set of GeoTIFF tiles.

func NewEUDEM

func NewEUDEM(fsys fs.FS, options ...GeoTIFFTileSetOption) (*GeoTIFFTileSet, error)

func NewGeoTIFFTileSet

func NewGeoTIFFTileSet(options ...GeoTIFFTileSetOption) (*GeoTIFFTileSet, error)

NewGeoTIFFileSet returns a new GeoTIFFTileSet with the given options.

func (*GeoTIFFTileSet) SRID

func (s *GeoTIFFTileSet) SRID() int

SRID returns s's SRID.

func (*GeoTIFFTileSet) Samples

func (s *GeoTIFFTileSet) Samples(ctx context.Context, coords []Coord) ([]float64, error)

Samples returns the samples at coords. Missing samples are represented by NaNs.

func (*GeoTIFFTileSet) Scale

func (s *GeoTIFFTileSet) Scale() (int, int)

Scale returns s's scale.

type GeoTIFFTileSetOption

type GeoTIFFTileSetOption func(*GeoTIFFTileSet)

A GeoTIFFTileSetOption sets an option on a GeoTIFFTileSet.

func WithCacheSize

func WithCacheSize(cacheSize int) GeoTIFFTileSetOption

func WithCanaryFilename

func WithCanaryFilename(canaryFilename string) GeoTIFFTileSetOption

func WithFS

func WithFS(fsys fs.FS) GeoTIFFTileSetOption

func WithGeoTIFFTileOptions

func WithGeoTIFFTileOptions(geoTIFFTileOptions ...GeoTIFFTileOption) GeoTIFFTileSetOption

func WithSRID

func WithSRID(srid int) GeoTIFFTileSetOption

func WithScale

func WithScale(scaleX, scaleY int) GeoTIFFTileSetOption

func WithTileCoordFunc

func WithTileCoordFunc(tileCoordFunc TileCoordFunc) GeoTIFFTileSetOption

func WithTileFilenameFunc

func WithTileFilenameFunc(tileFilenameFunc TileFilenameFunc) GeoTIFFTileSetOption

type ParsedGeoKeys

type ParsedGeoKeys struct {
	Params       map[GeoKey]int
	DoubleParams map[GeoKey]float64
	ASCIIParams  map[GeoKey]string
}

func ParseGeoKeys

func ParseGeoKeys(directory []uint16, doubleParams []float64, asciiParams []byte) (*ParsedGeoKeys, error)

type Raster

type Raster interface {
	Samples(ctx context.Context, coords []Coord) ([]float64, error)
	Scale() (int, int)
}

type TileCoord

type TileCoord struct {
	C int // Column.
	R int // Row.
}

A TileCoord is a tile coordinate.

type TileCoordFunc

type TileCoordFunc func(Coord) (TileCoord, bool)

A TileCoordFunc returns the tile coordinate for a coordinate.

type TileFilenameFunc

type TileFilenameFunc func(TileCoord) string

A TileFilenameFunc returns the tile filename for a tile coordinate.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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