image

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

Documentation

Index

Constants

View Source
const (
	TaskCancelledConsolidationError = ErrorConst("consolidation event is cancelled")
	NotImplementedError             = ErrorConst("consolidation without interleave records is not supported")
)

Variables

View Source
var (
	ErrNoCastToPerform = errors.New("no cast to perform")
	ErrUnableToCast    = errors.New("unableToCast")
)
View Source
var ErrLoger = godal.ErrLogger(func(ec godal.ErrorCategory, code int, msg string) error {
	if ec <= godal.CE_Warning {
		return nil
	}
	return fmt.Errorf("GDAL %d: %s", code, msg)
})

Functions

func CastDataset

func CastDataset(ctx context.Context, ds *godal.Dataset, fromDFormat, toDFormat geocube.DataMapping, dstDS string) (*godal.Dataset, error)

CastDataset creates a new dataset and cast fromDFormat toDFormat The caller is responsible to close the dataset fromDFormat: NoData is ignored dstDS [optional] If empty, the dataset is stored in memory

func DatasetToPngAsBytes

func DatasetToPngAsBytes(ctx context.Context, ds *godal.Dataset, fromDFormat geocube.DataMapping, palette *geocube.Palette, interpolateColor bool) ([]byte, error)

DatasetToPngAsBytes translates the dataset to a png and returns the byte representation interpolateColor is true if dataset pixel value can be interpolated

func DatasetToTiffAsBytes

func DatasetToTiffAsBytes(ds *godal.Dataset, fromDFormat geocube.DataMapping, tags map[string]string, palette *geocube.Palette) ([]byte, error)

DatasetToTiffAsBytes translates the dataset to a tiff and returns the byte representation

func MergeDatasets

func MergeDatasets(ctx context.Context, datasets []*Dataset, outDesc *GdalDatasetDescriptor) (*godal.Dataset, error)

MergeDatasets merge the given datasets into one in the format defined by outDesc The caller is responsible to close the output dataset

func WarpedExtent added in v0.6.0

func WarpedExtent(ctx context.Context, datasets []*Dataset, wktCRS string, resx, resy float64) ([4]float64, error)

WarpedExtent calls godal.WarpVRT on datasets, performing a reprojection and returning the extent

Types

type CogGenerator

type CogGenerator interface {
	Create(dataset *godal.Dataset, oContainer geocube.ConsolidationContainer, recordId, workDir string) (string, error)
	Open(ctx context.Context, filePath string) (*godal.Dataset, error)
}

func NewCogGenerator

func NewCogGenerator() CogGenerator

type Dataset added in v0.3.0

type Dataset struct {
	URI         string
	SubDir      string
	Bands       []int64
	DataMapping geocube.DataMapping
}

func (Dataset) GDALURI added in v0.3.0

func (d Dataset) GDALURI() string

type ErrorConst added in v0.3.0

type ErrorConst string

func (ErrorConst) Error added in v0.3.0

func (e ErrorConst) Error() string

type FileToDownload

type FileToDownload struct {
	URI      uri.DefaultUri
	LocalURI string
}

type GdalDatasetDescriptor

type GdalDatasetDescriptor struct {
	WktCRS        string
	PixToCRS      *affine.Affine
	Width, Height int
	Bands         int
	Resampling    geocube.Resampling
	DataMapping   geocube.DataMapping
	ValidPixPc    int // Minimum percentage of valid pixels (or image not found is returned)
	Format        string
	Palette       *geocube.Palette
}

type Handler

type Handler interface {
	Consolidate(ctx context.Context, cEvent *geocube.ConsolidationEvent, workspace string) error
}

func NewHandleConsolidation

func NewHandleConsolidation(c CogGenerator, m MucogGenerator, cancelledJobsStorage string, workers int, localDownload bool) Handler

type MucogGenerator

type MucogGenerator interface {
	Create(workDir string, cogListFile []string, interlacingPattern string) (string, error)
}

func NewMucogGenerator

func NewMucogGenerator() MucogGenerator

Jump to

Keyboard shortcuts

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