grid

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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReservedNames = []string{"regular", "singlecell"}

Functions

func CellsToJSON

func CellsToJSON(gr Grid, cellsURI []string) (string, error)

CellsToJSON converts an array of cells_uri to a geojson

Types

type Cell

type Cell struct {
	URI            string
	CRS            *godal.SpatialRef
	PixelToCRS     *affine.Affine // Transform from pixel to crs/geometric coordinates
	SizeX, SizeY   int
	GeographicRing proj.GeographicRing // lon/lat geodetic coordinates
	Ring           proj.Ring           // coordinates in the CRS
}

Cell is a polygon with a resolution on the surface of the Earth defined using either a WGS84 polygon or a projected polygon. Which of them is the reference

type Grid

type Grid interface {
	// Return the cell defined by the uris
	Cell(uri string) (*Cell, error)

	// Covers streams uris of cells covering the AOI.
	// The uris are unique, but the cells defined by the uris might overlap.
	Covers(ctx context.Context, aoi *geom.MultiPolygon) (<-chan StreamedURI, error)
}

func NewGrid

func NewGrid(flags []string, parameters map[string]string) (Grid, error)

NewGrid creates a new grid from flag and parameters (proj4 format) May return validation errors

type RegularGrid

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

RegularGrid in a given CRS with an origin and a spatial resolution parameters: - "crs" in gdal understandable format - "cell_size" or ("cell_x_size", "cell_y_size"): size of the cell - "resolution" in crs unit - "ox", "oy" origin in crs unit - "memory_limit" to prevent crash when covering a large aoi

func (*RegularGrid) Cell

func (rg *RegularGrid) Cell(uri string) (*Cell, error)

Cell implements Grid and returns a Cell in the regular grid with the provided URI (format : i/j))

func (*RegularGrid) Covers

func (rg *RegularGrid) Covers(ctx context.Context, geomAOI *geom.MultiPolygon) (<-chan StreamedURI, error)

Covers implements Grid

type SingleCellGrid

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

func (*SingleCellGrid) Cell

func (cg *SingleCellGrid) Cell(uri string) (*Cell, error)

Cell implements Grid and returns the Single Cell given the URI (format : originX/originY/sizeX/sizeY)

func (*SingleCellGrid) Covers

func (cg *SingleCellGrid) Covers(ctx context.Context, geomAOI *geom.MultiPolygon) (<-chan StreamedURI, error)

Covers

type StreamedURI added in v0.3.0

type StreamedURI struct {
	URI   string
	Error error
}

type UnsupportedGridErr added in v0.3.0

type UnsupportedGridErr struct {
	GridName string
}

UnsupportedGrid is raised when the GridName is not supported

func (UnsupportedGridErr) Error added in v0.3.0

func (err UnsupportedGridErr) Error() string

Jump to

Keyboard shortcuts

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