gdal

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 6 Imported by: 0

README

GDAL for Go

About

The gdal.go package provides a go wrapper for GDAL, the Geospatial Data Abstraction Library. More information about GDAL can be found at http://www.gdal.org

Installation

go get github.com/airmap/gdal

Compatibility

This software has been tested most recently on Alpine Linux, GDAL version 3.2.0.

Examples

See the examples directory for some starting points.

Status

GDAL 2.3.2 (3/08/2019):

  • The majority of GDAL functionality exposed by the C API is available, as well as much of the OGR API.
  • Most functionality is not covered by tests or benchmarks.

GDAL 3+ (10/21/2020):

  • GDAL functionality exposed by the C API that has been removed when GDAL 3 was released has also been removed from this Go API.

Documentation

Overview

Package gdal provides a wrapper for GDAL, the Geospatial Data Abstraction Library. This C/C++ library provides access to a large number of geospatial raster data formats. It also contains a wrapper for the related OGR Simple Feature Library which provides similar functionality for vector formats.

Limitations

Some less oftenly used functions are not yet implemented. The majoriry of these involve style tables, asynchronous I/O, and GCPs.

The documentation is fairly limited, but the functionality fairly closely matches that of the C++ api.

This wrapper has most recently been tested on Windows7, using the MinGW32_x64 compiler and GDAL version 1.11.

Usage

A simple program to create a georeferenced blank 256x256 GeoTIFF:

package main

import (
	"fmt"
	"flag"
	gdal "github.com/airmap/gdal"
)

func main() {
	flag.Parse()
	filename := flag.Arg(0)
	if filename == "" {
		fmt.Printf("Usage: tiff [filename]\n")
		return
	}
	buffer := make([]uint8, 256 * 256)

	driver, err := gdal.GetDriverByName("GTiff")
	if err != nil {
		fmt.Println(err.Error())
		return
	}

	dataset := driver.Create(filename, 256, 256, 1, gdal.Byte, nil)
	defer dataset.Close()

	spatialRef := gdal.CreateSpatialReference("")
	spatialRef.FromEPSG(3857)
	srString, err := spatialRef.ToWKT()
	dataset.SetProjection(srString)
	dataset.SetGeoTransform([]float64{444720, 30, 0, 3751320, 0, -30})
	raster := dataset.RasterBand(1)
	raster.IO(gdal.Write, 0, 0, 256, 256, buffer, 256, 256, 0, 0)
}

More examples can be found in the ./examples subdirectory.

Index

Constants

View Source
const (
	VERSION_MAJOR = int(C.GDAL_VERSION_MAJOR)
	VERSION_MINOR = int(C.GDAL_VERSION_MINOR)
	VERSION_REV   = int(C.GDAL_VERSION_REV)
	VERSION_BUILD = int(C.GDAL_VERSION_BUILD)
	VERSION_NUM   = int(C.GDAL_VERSION_NUM)
	RELEASE_DATE  = int(C.GDAL_RELEASE_DATE)
	RELEASE_NAME  = string(C.GDAL_RELEASE_NAME)
)
View Source
const (
	Unknown  = DataType(C.GDT_Unknown)
	Byte     = DataType(C.GDT_Byte)
	UInt16   = DataType(C.GDT_UInt16)
	Int16    = DataType(C.GDT_Int16)
	UInt32   = DataType(C.GDT_UInt32)
	Int32    = DataType(C.GDT_Int32)
	Float32  = DataType(C.GDT_Float32)
	Float64  = DataType(C.GDT_Float64)
	CInt16   = DataType(C.GDT_CInt16)
	CInt32   = DataType(C.GDT_CInt32)
	CFloat32 = DataType(C.GDT_CFloat32)
	CFloat64 = DataType(C.GDT_CFloat64)
)
View Source
const (
	// Read only (no update) access
	ReadOnly = Access(C.GA_ReadOnly)
	// Read/write access.
	Update = Access(C.GA_Update)
)
View Source
const (
	// Read data
	Read = RWFlag(C.GF_Read)
	// Write data
	Write = RWFlag(C.GF_Write)
)
View Source
const (
	OFReadOnly      = OpenFlag(C.GDAL_OF_READONLY)
	OFUpdate        = OpenFlag(C.GDAL_OF_UPDATE)
	OFShared        = OpenFlag(C.GDAL_OF_SHARED)
	OFVector        = OpenFlag(C.GDAL_OF_VECTOR)
	OFRaster        = OpenFlag(C.GDAL_OF_RASTER)
	OFVerbose_Error = OpenFlag(C.GDAL_OF_VERBOSE_ERROR)
)
View Source
const (
	CI_Undefined      = ColorInterp(C.GCI_Undefined)
	CI_GrayIndex      = ColorInterp(C.GCI_GrayIndex)
	CI_PaletteIndex   = ColorInterp(C.GCI_PaletteIndex)
	CI_RedBand        = ColorInterp(C.GCI_RedBand)
	CI_GreenBand      = ColorInterp(C.GCI_GreenBand)
	CI_BlueBand       = ColorInterp(C.GCI_BlueBand)
	CI_AlphaBand      = ColorInterp(C.GCI_AlphaBand)
	CI_HueBand        = ColorInterp(C.GCI_HueBand)
	CI_SaturationBand = ColorInterp(C.GCI_SaturationBand)
	CI_LightnessBand  = ColorInterp(C.GCI_LightnessBand)
	CI_CyanBand       = ColorInterp(C.GCI_CyanBand)
	CI_MagentaBand    = ColorInterp(C.GCI_MagentaBand)
	CI_YellowBand     = ColorInterp(C.GCI_YellowBand)
	CI_BlackBand      = ColorInterp(C.GCI_BlackBand)
	CI_YCbCr_YBand    = ColorInterp(C.GCI_YCbCr_YBand)
	CI_YCbCr_CbBand   = ColorInterp(C.GCI_YCbCr_CbBand)
	CI_YCbCr_CrBand   = ColorInterp(C.GCI_YCbCr_CrBand)
	CI_Max            = ColorInterp(C.GCI_Max)
)
View Source
const (
	// Grayscale (in GDALColorEntry.c1)
	PI_Gray = PaletteInterp(C.GPI_Gray)
	// Red, Green, Blue and Alpha in (in c1, c2, c3 and c4)
	PI_RGB = PaletteInterp(C.GPI_RGB)
	// Cyan, Magenta, Yellow and Black (in c1, c2, c3 and c4)
	PI_CMYK = PaletteInterp(C.GPI_CMYK)
	// Hue, Lightness and Saturation (in c1, c2, and c3)
	PI_HLS = PaletteInterp(C.GPI_HLS)
)
View Source
const (
	MD_AREA_OR_POINT = string(C.GDALMD_AREA_OR_POINT)
	MD_AOP_AREA      = string(C.GDALMD_AOP_AREA)
	MD_AOP_POINT     = string(C.GDALMD_AOP_POINT)
)

"well known" metadata items.

View Source
const (
	DMD_LONGNAME           = string(C.GDAL_DMD_LONGNAME)
	DMD_HELPTOPIC          = string(C.GDAL_DMD_HELPTOPIC)
	DMD_MIMETYPE           = string(C.GDAL_DMD_MIMETYPE)
	DMD_EXTENSION          = string(C.GDAL_DMD_EXTENSION)
	DMD_CREATIONOPTIONLIST = string(C.GDAL_DMD_CREATIONOPTIONLIST)
	DMD_CREATIONDATATYPES  = string(C.GDAL_DMD_CREATIONDATATYPES)

	DCAP_CREATE     = string(C.GDAL_DCAP_CREATE)
	DCAP_CREATECOPY = string(C.GDAL_DCAP_CREATECOPY)
	DCAP_VIRTUALIO  = string(C.GDAL_DCAP_VIRTUALIO)
)
View Source
const (
	GRA_NearestNeighbour = ResampleAlg(0)
	GRA_Bilinear         = ResampleAlg(1)
	GRA_Cubic            = ResampleAlg(2)
	GRA_CubicSpline      = ResampleAlg(3)
	GRA_Lanczos          = ResampleAlg(4)
)
View Source
const (
	GFT_Integer = RATFieldType(C.GFT_Integer)
	GFT_Real    = RATFieldType(C.GFT_Real)
	GFT_String  = RATFieldType(C.GFT_String)
)
View Source
const (
	GFU_Generic    = RATFieldUsage(C.GFU_Generic)
	GFU_PixelCount = RATFieldUsage(C.GFU_PixelCount)
	GFU_Name       = RATFieldUsage(C.GFU_Name)
	GFU_Min        = RATFieldUsage(C.GFU_Min)
	GFU_Max        = RATFieldUsage(C.GFU_Max)
	GFU_MinMax     = RATFieldUsage(C.GFU_MinMax)
	GFU_Red        = RATFieldUsage(C.GFU_Red)
	GFU_Green      = RATFieldUsage(C.GFU_Green)
	GFU_Blue       = RATFieldUsage(C.GFU_Blue)
	GFU_Alpha      = RATFieldUsage(C.GFU_Alpha)
	GFU_RedMin     = RATFieldUsage(C.GFU_RedMin)
	GFU_GreenMin   = RATFieldUsage(C.GFU_GreenMin)
	GFU_BlueMin    = RATFieldUsage(C.GFU_BlueMin)
	GFU_AlphaMin   = RATFieldUsage(C.GFU_AlphaMin)
	GFU_RedMax     = RATFieldUsage(C.GFU_RedMax)
	GFU_GreenMax   = RATFieldUsage(C.GFU_GreenMax)
	GFU_BlueMax    = RATFieldUsage(C.GFU_BlueMax)
	GFU_AlphaMax   = RATFieldUsage(C.GFU_AlphaMax)
	GFU_MaxCount   = RATFieldUsage(C.GFU_MaxCount)
)

Variables

View Source
var (
	ErrDebug   = errors.New("Debug Error")
	ErrWarning = errors.New("Warning Error")
	ErrFailure = errors.New("Failure Error")
	ErrFatal   = errors.New("Fatal Error")
	ErrIllegal = errors.New("Illegal Error")

	ErrorLevelNone    = ErrorLevel(C.CE_None)
	ErrorLevelDebug   = ErrorLevel(C.CE_Debug)
	ErrorLevelWarning = ErrorLevel(C.CE_Warning)
	ErrorLevelFailure = ErrorLevel(C.CE_Failure)
	ErrorLevelFatal   = ErrorLevel(C.CE_Fatal)

	ErrorNumberNone            = ErrorNumber(C.CPLE_None)
	ErrorNumberAppDefined      = ErrorNumber(C.CPLE_AppDefined)
	ErrorNumberOutOfMemory     = ErrorNumber(C.CPLE_OutOfMemory)
	ErrorNumberFileIO          = ErrorNumber(C.CPLE_FileIO)
	ErrorNumberOpenFailed      = ErrorNumber(C.CPLE_OpenFailed)
	ErrorNumberIllegalArg      = ErrorNumber(C.CPLE_IllegalArg)
	ErrorNumberNotSupported    = ErrorNumber(C.CPLE_NotSupported)
	ErrorNumberAssertionFailed = ErrorNumber(C.CPLE_AssertionFailed)
	ErrorNumberNoWriteAccess   = ErrorNumber(C.CPLE_NoWriteAccess)
	ErrorNumberUserInterrupt   = ErrorNumber(C.CPLE_UserInterrupt)
	ErrorNumberObjectNull      = ErrorNumber(C.CPLE_ObjectNull)
	ErrorNumberHTTPResponse    = ErrorNumber(C.CPLE_HttpResponse)
)

Functions

func CIntSliceToInt

func CIntSliceToInt(data []C.int) []int

Safe array conversion

func CUIntBigSliceToInt added in v0.0.5

func CUIntBigSliceToInt(data []C.GUIntBig) []int

func CreateScaledProgress

func CreateScaledProgress(min, max float64, progress ProgressFunc, data unsafe.Pointer) unsafe.Pointer

func DestroyDriverManager

func DestroyDriverManager()

Destroy the driver manager

func DestroyScaledProgress

func DestroyScaledProgress(data unsafe.Pointer)

func DummyProgress

func DummyProgress(complete float64, message string, data interface{}) int

func FlushCacheBlock

func FlushCacheBlock() bool

Try to flush one cached raster block

func GetCacheMax

func GetCacheMax() int

Get maximum cache memory

func GetCacheUsed

func GetCacheUsed() int

Get cache memory used

func GetDriverCount

func GetDriverCount() int

Fetch the number of registered drivers.

func Info added in v0.0.5

func Info(sourceDS Dataset, options []string) string

func InstallErrorHandler added in v0.0.3

func InstallErrorHandler(eh ErrorHandler)

InstallErrorHandler installs eh as the current error handler.

func IntSliceToCInt

func IntSliceToCInt(data []int) []C.int

func InvGeoTransform

func InvGeoTransform(transform [6]float64) [6]float64

Invert the supplied transform

func ScaledProgress

func ScaledProgress(complete float64, message string, data interface{}) int

func SetCacheMax

func SetCacheMax(bytes int)

Set maximum cache memory

func TermProgress

func TermProgress(complete float64, message string, data interface{}) int

func VSIFCloseL added in v0.0.5

func VSIFCloseL(file VSILFILE)

Close file.

func VSIFReadL added in v0.0.5

func VSIFReadL(nSize, nCount int, file VSILFILE) []byte

Read bytes from file.

func VSIMkdir added in v0.0.5

func VSIMkdir(dir string) error

Create a new directory with the indicated mode. The mode is ignored on some platforms. A reasonable default mode value would be 0666. This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.

func VSIMkdirRecursive added in v0.0.5

func VSIMkdirRecursive(dir string) error

Create a directory and all its ancestors.

func VSIReadDirRecursive added in v0.0.5

func VSIReadDirRecursive(filename string) []string

List VSI files

func VSIRmdir added in v0.0.5

func VSIRmdir(dir string) error

Deletes a directory object from the file system. On some systems the directory must be empty before it can be deleted. This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.

func VSIRmdirRecursive added in v0.0.5

func VSIRmdirRecursive(dir string) error

Delete a directory recursively. Deletes a directory object and its content from the file system. Starting with GDAL 3.1, /vsis3/ has an efficient implementation of this function.

func VSIUnlink(fileName string) error

Delete a file. This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.

Types

type Access

type Access int

Flag indicating read/write, or read-only access to data.

type AsyncReader

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

type AsyncStatusType

type AsyncStatusType int

status of the asynchronous stream

func GetAsyncStatusTypeByName

func GetAsyncStatusTypeByName(statusTypeName string) AsyncStatusType

func (AsyncStatusType) Name

func (statusType AsyncStatusType) Name() string

type ColorEntry

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

func (*ColorEntry) Get added in v0.0.5

func (ce *ColorEntry) Get() (c1, c2, c3, c4 uint8)

func (*ColorEntry) Set added in v0.0.5

func (ce *ColorEntry) Set(c1, c2, c3, c4 uint)

type ColorInterp

type ColorInterp int

Types of color interpretation for raster bands.

func GetColorInterpretationByName

func GetColorInterpretationByName(name string) ColorInterp

func (ColorInterp) Name

func (colorInterp ColorInterp) Name() string

type ColorTable

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

func CreateColorTable

func CreateColorTable(interp PaletteInterp) ColorTable

Construct a new color table

func (ColorTable) Clone

func (ct ColorTable) Clone() ColorTable

Make a copy of the color table

func (ColorTable) CreateColorRamp

func (ct ColorTable) CreateColorRamp(start, end int, startColor, endColor ColorEntry)

Create color ramp

func (ColorTable) Destroy

func (ct ColorTable) Destroy()

Destroy the color table

func (ColorTable) Entry

func (ct ColorTable) Entry(index int) ColorEntry

Fetch a color entry from table

func (ColorTable) EntryCount

func (ct ColorTable) EntryCount() int

Get number of color entries in table

func (ColorTable) PaletteInterpretation

func (ct ColorTable) PaletteInterpretation() PaletteInterp

Fetch palette interpretation

func (ColorTable) SetEntry

func (ct ColorTable) SetEntry(index int, entry ColorEntry)

Set entry in color table

type DataType

type DataType int

Pixel data types

func (DataType) IsComplex

func (dataType DataType) IsComplex() int

func (DataType) Name

func (dataType DataType) Name() string

func (DataType) Size

func (dataType DataType) Size() int

Get data type size in bits.

func (DataType) Union

func (dataType DataType) Union(dataTypeB DataType) DataType

type Dataset

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

func GDALTranslate added in v0.0.5

func GDALTranslate(
	destName string,
	srcDS Dataset,
	options []string,
) Dataset

func GDALWarp added in v0.0.5

func GDALWarp(
	destName string,
	dstDs Dataset,
	srcDs []Dataset,
	options []string,
) Dataset

func Open

func Open(filename string, access Access) (Dataset, error)

Open an existing dataset

func OpenEx added in v0.0.5

func OpenEx(filename string, flags OpenFlag, allowedDrivers []string,
	openOptions []string, siblingFiles []string) (Dataset, error)

Open an existing dataset

func OpenShared

func OpenShared(filename string, access Access) Dataset

Open a shared existing dataset

func Rasterize added in v0.0.5

func Rasterize(dstDS string, sourceDS Dataset, options []string) (Dataset, error)

func Translate added in v0.0.5

func Translate(dstDS string, sourceDS Dataset, options []string) (Dataset, error)

func VectorTranslate added in v0.0.5

func VectorTranslate(dstDS string, sourceDS []Dataset, options []string) (Dataset, error)

func Warp added in v0.0.5

func Warp(dstDS string, sourceDS []Dataset, options []string) (Dataset, error)

func (Dataset) Access

func (dataset Dataset) Access() Access

Return access flag

func (Dataset) AddBand

func (dataset Dataset) AddBand(dataType DataType, options []string) error

Add a band to a dataset

func (Dataset) AdviseRead

func (dataset Dataset) AdviseRead(
	rwFlag RWFlag,
	xOff, yOff, xSize, ySize, bufXSize, bufYSize int,
	dataType DataType,
	bandCount int,
	bandMap []int,
	options []string,
) error

Advise driver of upcoming read requests

func (Dataset) AutoCreateWarpedVRT

func (dataset Dataset) AutoCreateWarpedVRT(srcWKT, dstWKT string, resampleAlg ResampleAlg) (Dataset, error)

func (Dataset) BuildOverviews

func (dataset Dataset) BuildOverviews(
	resampling string,
	nOverviews int,
	overviewList []int,
	nBands int,
	bandList []int,
	progress ProgressFunc,
	data interface{},
) error

Build raster overview(s)

func (Dataset) Close

func (dataset Dataset) Close()

Close the dataset

func (Dataset) CopyWholeRaster

func (sourceDataset Dataset) CopyWholeRaster(
	destDataset Dataset,
	options []string,
	progress ProgressFunc,
	data interface{},
) error

Copy all dataset raster data

func (Dataset) CreateMaskBand

func (dataset Dataset) CreateMaskBand(flags int) error

Adds a mask band to the dataset

func (Dataset) Driver

func (dataset Dataset) Driver() Driver

Get the driver to which this dataset relates

func (Dataset) FileList

func (dataset Dataset) FileList() []string

Fetch files forming the dataset.

func (Dataset) FlushCache

func (dataset Dataset) FlushCache()

Write all write cached data to disk

func (Dataset) GDALDereferenceDataset

func (dataset Dataset) GDALDereferenceDataset() int

Subtract one from dataset reference count

func (Dataset) GDALGetGCPCount

func (dataset Dataset) GDALGetGCPCount() int

Get number of GCPs

func (Dataset) GDALGetInternalHandle

func (dataset Dataset) GDALGetInternalHandle(request string) unsafe.Pointer

Fetch a format specific internally meaningful handle

func (Dataset) GDALReferenceDataset

func (dataset Dataset) GDALReferenceDataset() int

Add one to dataset reference count

func (Dataset) GeoTransform

func (dataset Dataset) GeoTransform() [6]float64

Get the affine transformation coefficients

func (Dataset) IO

func (dataset Dataset) IO(
	rwFlag RWFlag,
	xOff, yOff, xSize, ySize int,
	buffer interface{},
	bufXSize, bufYSize int,
	bandCount int,
	bandMap []int,
	pixelSpace, lineSpace, bandSpace int,
) error

Read / write a region of image data from multiple bands

func (Dataset) InvGeoTransform

func (dataset Dataset) InvGeoTransform() [6]float64

Return the inverted transform

func (*Dataset) Metadata added in v0.0.5

func (dataset *Dataset) Metadata(domain string) []string

func (*Dataset) MetadataItem added in v0.0.5

func (object *Dataset) MetadataItem(name, domain string) string

func (Dataset) Projection

func (dataset Dataset) Projection() string

Fetch the projection definition string for this dataset

func (Dataset) RasterBand

func (dataset Dataset) RasterBand(band int) RasterBand

Fetch a raster band object from a dataset

func (Dataset) RasterCount

func (dataset Dataset) RasterCount() int

Fetch the number of raster bands in the dataset

func (Dataset) RasterXSize

func (dataset Dataset) RasterXSize() int

Fetch X size of raster

func (Dataset) RasterYSize

func (dataset Dataset) RasterYSize() int

Fetch Y size of raster

func (Dataset) SetGeoTransform

func (dataset Dataset) SetGeoTransform(transform [6]float64) error

Set the affine transformation coefficients

func (*Dataset) SetMetadataItem

func (object *Dataset) SetMetadataItem(name, value, domain string) error

func (Dataset) SetProjection

func (dataset Dataset) SetProjection(proj string) error

Set the projection reference string

type Driver

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

func GetDriver

func GetDriver(index int) Driver

Fetch driver by index

func GetDriverByName

func GetDriverByName(driverName string) (Driver, error)

Return the driver by short name

func IdentifyDriver

func IdentifyDriver(filename string, filenameList []string) Driver

Return the driver needed to access the provided dataset name.

func (Driver) CopyDatasetFiles

func (driver Driver) CopyDatasetFiles(newName, oldName string) error

Copy all files associated with the named dataset

func (Driver) Create

func (driver Driver) Create(
	filename string,
	xSize, ySize, bands int,
	dataType DataType,
	options []string,
) Dataset

Create a new dataset with this driver.

func (Driver) CreateCopy

func (driver Driver) CreateCopy(
	filename string,
	sourceDataset Dataset,
	strict int,
	options []string,
	progress ProgressFunc,
	data interface{},
) Dataset

Create a copy of a dataset

func (Driver) DeleteDataset

func (driver Driver) DeleteDataset(name string) error

Delete named dataset

func (Driver) Deregister

func (driver Driver) Deregister()

Reregister the driver

func (Driver) Destroy

func (driver Driver) Destroy()

Destroy a GDAL driver

func (Driver) LongName

func (driver Driver) LongName() string

Get the long name associated with this driver

func (*Driver) MetadataItem

func (object *Driver) MetadataItem(name, domain string) string

Fetch single metadata item.

func (Driver) Register

func (driver Driver) Register() int

Registers a driver for use

func (Driver) RenameDataset

func (driver Driver) RenameDataset(newName, oldName string) error

Rename named dataset

func (Driver) ShortName

func (driver Driver) ShortName() string

Get the short name associated with this driver

type ErrorHandler added in v0.0.3

type ErrorHandler func(ErrorLevel, ErrorNumber, string)

ErrorHandler models a callback for error messages.

type ErrorLevel added in v0.0.4

type ErrorLevel int

ErrorLevel describes the urgency of an error.

type ErrorNumber added in v0.0.4

type ErrorNumber int

ErrorNumber provides a classification of an error.

type GDALTranslateOptions added in v0.0.5

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

type GDALWarpAppOptions added in v0.0.5

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

type MajorObject

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

func (MajorObject) Description

func (object MajorObject) Description() string

Fetch object description

func (MajorObject) Metadata

func (object MajorObject) Metadata(domain string) []string

Fetch metadata

func (MajorObject) MetadataItem

func (object MajorObject) MetadataItem(name, domain string) string

Fetch a single metadata item

func (MajorObject) SetDescription

func (object MajorObject) SetDescription(desc string)

Set object description

func (MajorObject) SetMetadata

func (object MajorObject) SetMetadata(metadata []string, domain string)

Set metadata

func (MajorObject) SetMetadataItem

func (object MajorObject) SetMetadataItem(name, value, domain string)

Set a single metadata item

type OpenFlag added in v0.0.5

type OpenFlag uint

type PaletteInterp

type PaletteInterp int

Types of color interpretations for a GDALColorTable.

func (PaletteInterp) Name

func (paletteInterp PaletteInterp) Name() string

type ProgressFunc

type ProgressFunc func(complete float64, message string, progressArg interface{}) int

type RATFieldType

type RATFieldType int

type RATFieldUsage

type RATFieldUsage int

type RWFlag

type RWFlag int

Read/Write flag for RasterIO() method

type RasterAttributeTable

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

func CreateRasterAttributeTable

func CreateRasterAttributeTable() RasterAttributeTable

Construct empty raster attribute table

func (RasterAttributeTable) ColOfUsage

func (rat RasterAttributeTable) ColOfUsage(rfu RATFieldUsage) int

Fetch column index for indicated usage

func (RasterAttributeTable) ColumnCount

func (rat RasterAttributeTable) ColumnCount() int

Fetch table column count

func (RasterAttributeTable) CreateColumn

func (rat RasterAttributeTable) CreateColumn(name string, rft RATFieldType, rfu RATFieldUsage) error

Create new column

func (RasterAttributeTable) Destroy

func (rat RasterAttributeTable) Destroy()

Destroy a RAT

func (RasterAttributeTable) FromColorTable

func (rat RasterAttributeTable) FromColorTable(ct ColorTable) error

Initialize RAT from color table

func (RasterAttributeTable) LinearBinning

func (rat RasterAttributeTable) LinearBinning() (row0min, binsize float64, exists bool)

Fetch linear binning information

func (RasterAttributeTable) NameOfCol

func (rat RasterAttributeTable) NameOfCol(index int) string

Fetch the name of indicated column

func (RasterAttributeTable) RowCount

func (rat RasterAttributeTable) RowCount() int

Fetch row count

func (RasterAttributeTable) RowOfValue

func (rat RasterAttributeTable) RowOfValue(val float64) (int, bool)

Get row for pixel value

func (RasterAttributeTable) SetLinearBinning

func (rat RasterAttributeTable) SetLinearBinning(row0min, binsize float64) error

Set linear binning information

func (RasterAttributeTable) SetRowCount

func (rat RasterAttributeTable) SetRowCount(count int)

Set row count

func (RasterAttributeTable) SetValueAsFloat64

func (rat RasterAttributeTable) SetValueAsFloat64(row, field int, val float64)

Set field value from float64

func (RasterAttributeTable) SetValueAsInt

func (rat RasterAttributeTable) SetValueAsInt(row, field, val int)

Set field value from integer

func (RasterAttributeTable) SetValueAsString

func (rat RasterAttributeTable) SetValueAsString(row, field int, val string)

Set field value from string

func (RasterAttributeTable) ToColorTable

func (rat RasterAttributeTable) ToColorTable(count int) ColorTable

Translate RAT to a color table

func (RasterAttributeTable) TypeOfCol

func (rat RasterAttributeTable) TypeOfCol(index int) RATFieldType

Fetch the type of indicated column

func (RasterAttributeTable) UsageOfCol

func (rat RasterAttributeTable) UsageOfCol(index int) RATFieldUsage

Fetch the usage of indicated column

func (RasterAttributeTable) ValueAsFloat64

func (rat RasterAttributeTable) ValueAsFloat64(row, field int) float64

Fetch field value as float64

func (RasterAttributeTable) ValueAsInt

func (rat RasterAttributeTable) ValueAsInt(row, field int) int

Fetch field value as integer

func (RasterAttributeTable) ValueAsString

func (rat RasterAttributeTable) ValueAsString(row, field int) string

Fetch field value as string

type RasterBand

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

func (RasterBand) AdviseRead

func (rasterBand RasterBand) AdviseRead(
	xOff, yOff, xSize, ySize, bufXSize, bufYSize int,
	dataType DataType,
	options []string,
) error

Advise driver of upcoming read requests

func (RasterBand) BandNumber

func (rasterBand RasterBand) BandNumber() int

Fetch the band number of this raster band

func (RasterBand) BlockSize

func (rasterBand RasterBand) BlockSize() (int, int)

Fetch the "natural" block size of this band

func (RasterBand) CategoryNames

func (rasterBand RasterBand) CategoryNames() []string

Fetch the list of category names for this raster

func (RasterBand) ColorInterp

func (rasterBand RasterBand) ColorInterp() ColorInterp

How should this band be interpreted as color?

func (RasterBand) ColorTable

func (rasterBand RasterBand) ColorTable() ColorTable

Fetch the color table associated with this raster band

func (RasterBand) ComputeMinMax

func (rasterBand RasterBand) ComputeMinMax(approxOK int) (min, max float64)

Compute the min / max values for a band

func (RasterBand) ComputeStatistics

func (rasterBand RasterBand) ComputeStatistics(
	approxOK int,
	progress ProgressFunc,
	data interface{},
) (min, max, mean, stdDev float64)

Compute image statistics

func (RasterBand) CreateMaskBand

func (rasterBand RasterBand) CreateMaskBand(flags int) error

Adds a mask band to the current band

func (RasterBand) DefaultHistogram

func (rasterBand RasterBand) DefaultHistogram(
	force int,
	progress ProgressFunc,
	data interface{},
) (min, max float64, buckets int, histogram []int, err error)

Fetch default raster histogram

func (RasterBand) Fill

func (rasterBand RasterBand) Fill(real, imaginary float64) error

Fill this band with a constant value

func (RasterBand) FlushCache

func (rasterBand RasterBand) FlushCache()

Flush raster data cache

func (RasterBand) GetAccess

func (rasterBand RasterBand) GetAccess() Access

Find out if we have update permission for this band

func (RasterBand) GetDataset

func (rasterBand RasterBand) GetDataset() Dataset

Fetch the owning dataset handle

func (RasterBand) GetDefaultRAT

func (rasterBand RasterBand) GetDefaultRAT() RasterAttributeTable

Fetch default Raster Attribute Table

func (RasterBand) GetMaskBand

func (rasterBand RasterBand) GetMaskBand() RasterBand

Return the mask band associated with the band

func (RasterBand) GetMaskFlags

func (rasterBand RasterBand) GetMaskFlags() int

Return the status flags of the mask band associated with the band

func (RasterBand) GetMaximum

func (rasterBand RasterBand) GetMaximum() (val float64, valid bool)

Fetch the maximum value for this band

func (RasterBand) GetMinimum

func (rasterBand RasterBand) GetMinimum() (val float64, valid bool)

Fetch the minimum value for this band

func (RasterBand) GetOffset

func (rasterBand RasterBand) GetOffset() (float64, bool)

Fetch the raster value offset

func (RasterBand) GetScale

func (rasterBand RasterBand) GetScale() (float64, bool)

Fetch the raster value scale

func (RasterBand) GetStatistics

func (rasterBand RasterBand) GetStatistics(approxOK, force int) (min, max, mean, stdDev float64)

Fetch image statistics

func (RasterBand) GetUnitType

func (rasterBand RasterBand) GetUnitType() string

Return raster unit type

func (RasterBand) HasArbitraryOverviews

func (rasterBand RasterBand) HasArbitraryOverviews() int

Check for arbitrary overviews

func (RasterBand) Histogram

func (rasterBand RasterBand) Histogram(
	min, max float64,
	buckets int,
	includeOutOfRange, approxOK int,
	progress ProgressFunc,
	data interface{},
) ([]int, error)

Compute raster histogram

func (RasterBand) IO

func (rasterBand RasterBand) IO(
	rwFlag RWFlag,
	xOff, yOff, xSize, ySize int,
	buffer interface{},
	bufXSize, bufYSize int,
	pixelSpace, lineSpace int,
) error

Read / Write a region of image data for this band

func (*RasterBand) MetadataItem added in v0.0.5

func (object *RasterBand) MetadataItem(name, domain string) string

func (RasterBand) NoDataValue

func (rasterBand RasterBand) NoDataValue() (val float64, valid bool)

Fetch the no data value for this band

func (RasterBand) Overview

func (rasterBand RasterBand) Overview(level int) RasterBand

Fetch overview raster band object

func (RasterBand) OverviewCount

func (rasterBand RasterBand) OverviewCount() int

Return the number of overview layers available

func (RasterBand) RasterBandCopyWholeRaster

func (sourceRaster RasterBand) RasterBandCopyWholeRaster(
	destRaster RasterBand,
	options []string,
	progress ProgressFunc,
	data interface{},
) error

Copy all raster band raster data

func (RasterBand) RasterDataType

func (rasterBand RasterBand) RasterDataType() DataType

Fetch the pixel data type for this band

func (RasterBand) ReadBlock

func (rasterBand RasterBand) ReadBlock(xOff, yOff int, dataPtr unsafe.Pointer) error

Read a block of image data efficiently

func (RasterBand) SetColorInterp

func (rasterBand RasterBand) SetColorInterp(colorInterp ColorInterp) error

Set color interpretation of the raster band

func (RasterBand) SetColorTable

func (rasterBand RasterBand) SetColorTable(colorTable ColorTable) error

Set the raster color table for this raster band

func (RasterBand) SetDefaultRAT

func (rasterBand RasterBand) SetDefaultRAT(rat RasterAttributeTable) error

Set default Raster Attribute Table

func (*RasterBand) SetMetadataItem

func (rasterBand *RasterBand) SetMetadataItem(name, value, domain string) error

func (RasterBand) SetNoDataValue

func (rasterBand RasterBand) SetNoDataValue(val float64) error

Set the no data value for this band

func (RasterBand) SetOffset

func (rasterBand RasterBand) SetOffset(offset float64) error

Set scaling offset

func (RasterBand) SetRasterCategoryNames

func (rasterBand RasterBand) SetRasterCategoryNames(names []string) error

Set the category names for this band

func (RasterBand) SetScale

func (rasterBand RasterBand) SetScale(scale float64) error

Set scaling ratio

func (RasterBand) SetStatistics

func (rasterBand RasterBand) SetStatistics(min, max, mean, stdDev float64) error

Set statistics on raster band

func (RasterBand) SetUnitType

func (rasterBand RasterBand) SetUnitType(unit string) error

Set unit type

func (RasterBand) WriteBlock

func (rasterBand RasterBand) WriteBlock(xOff, yOff int, dataPtr unsafe.Pointer) error

Write a block of image data efficiently

func (RasterBand) XSize

func (rasterBand RasterBand) XSize() int

Fetch X size of raster

func (RasterBand) YSize

func (rasterBand RasterBand) YSize() int

Fetch Y size of raster

type ResampleAlg

type ResampleAlg int

type VSILFILE added in v0.0.5

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

func VSIFOpenL added in v0.0.5

func VSIFOpenL(fileName string, fileAccess string) (VSILFILE, error)

Open file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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