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
- Variables
- func CIntSliceToInt(data []C.int) []int
- func CUIntBigSliceToInt(data []C.GUIntBig) []int
- func CreateScaledProgress(min, max float64, progress ProgressFunc, data unsafe.Pointer) unsafe.Pointer
- func DestroyDriverManager()
- func DestroyScaledProgress(data unsafe.Pointer)
- func DummyProgress(complete float64, message string, data interface{}) int
- func FlushCacheBlock() bool
- func GetCacheMax() int
- func GetCacheUsed() int
- func GetDriverCount() int
- func Info(sourceDS Dataset, options []string) string
- func InstallErrorHandler(eh ErrorHandler)
- func IntSliceToCInt(data []int) []C.int
- func InvGeoTransform(transform [6]float64) [6]float64
- func ScaledProgress(complete float64, message string, data interface{}) int
- func SetCacheMax(bytes int)
- func TermProgress(complete float64, message string, data interface{}) int
- func VSIFCloseL(file VSILFILE)
- func VSIFReadL(nSize, nCount int, file VSILFILE) []byte
- func VSIMkdir(dir string) error
- func VSIMkdirRecursive(dir string) error
- func VSIReadDirRecursive(filename string) []string
- func VSIRmdir(dir string) error
- func VSIRmdirRecursive(dir string) error
- func VSIUnlink(fileName string) error
- type Access
- type AsyncReader
- type AsyncStatusType
- type ColorEntry
- type ColorInterp
- type ColorTable
- func (ct ColorTable) Clone() ColorTable
- func (ct ColorTable) CreateColorRamp(start, end int, startColor, endColor ColorEntry)
- func (ct ColorTable) Destroy()
- func (ct ColorTable) Entry(index int) ColorEntry
- func (ct ColorTable) EntryCount() int
- func (ct ColorTable) PaletteInterpretation() PaletteInterp
- func (ct ColorTable) SetEntry(index int, entry ColorEntry)
- type DataType
- type Dataset
- func GDALTranslate(destName string, srcDS Dataset, options []string) Dataset
- func GDALWarp(destName string, dstDs Dataset, srcDs []Dataset, options []string) Dataset
- func Open(filename string, access Access) (Dataset, error)
- func OpenEx(filename string, flags OpenFlag, allowedDrivers []string, openOptions []string, ...) (Dataset, error)
- func OpenShared(filename string, access Access) Dataset
- func Rasterize(dstDS string, sourceDS Dataset, options []string) (Dataset, error)
- func Translate(dstDS string, sourceDS Dataset, options []string) (Dataset, error)
- func VectorTranslate(dstDS string, sourceDS []Dataset, options []string) (Dataset, error)
- func Warp(dstDS string, sourceDS []Dataset, options []string) (Dataset, error)
- func (dataset Dataset) Access() Access
- func (dataset Dataset) AddBand(dataType DataType, options []string) error
- func (dataset Dataset) AdviseRead(rwFlag RWFlag, xOff, yOff, xSize, ySize, bufXSize, bufYSize int, ...) error
- func (dataset Dataset) AutoCreateWarpedVRT(srcWKT, dstWKT string, resampleAlg ResampleAlg) (Dataset, error)
- func (dataset Dataset) BuildOverviews(resampling string, nOverviews int, overviewList []int, nBands int, ...) error
- func (dataset Dataset) Close()
- func (sourceDataset Dataset) CopyWholeRaster(destDataset Dataset, options []string, progress ProgressFunc, data interface{}) error
- func (dataset Dataset) CreateMaskBand(flags int) error
- func (dataset Dataset) Driver() Driver
- func (dataset Dataset) FileList() []string
- func (dataset Dataset) FlushCache()
- func (dataset Dataset) GDALDereferenceDataset() int
- func (dataset Dataset) GDALGetGCPCount() int
- func (dataset Dataset) GDALGetInternalHandle(request string) unsafe.Pointer
- func (dataset Dataset) GDALReferenceDataset() int
- func (dataset Dataset) GeoTransform() [6]float64
- func (dataset Dataset) IO(rwFlag RWFlag, xOff, yOff, xSize, ySize int, buffer interface{}, ...) error
- func (dataset Dataset) InvGeoTransform() [6]float64
- func (dataset *Dataset) Metadata(domain string) []string
- func (object *Dataset) MetadataItem(name, domain string) string
- func (dataset Dataset) Projection() string
- func (dataset Dataset) RasterBand(band int) RasterBand
- func (dataset Dataset) RasterCount() int
- func (dataset Dataset) RasterXSize() int
- func (dataset Dataset) RasterYSize() int
- func (dataset Dataset) SetGeoTransform(transform [6]float64) error
- func (object *Dataset) SetMetadataItem(name, value, domain string) error
- func (dataset Dataset) SetProjection(proj string) error
- type Driver
- func (driver Driver) CopyDatasetFiles(newName, oldName string) error
- func (driver Driver) Create(filename string, xSize, ySize, bands int, dataType DataType, options []string) Dataset
- func (driver Driver) CreateCopy(filename string, sourceDataset Dataset, strict int, options []string, ...) Dataset
- func (driver Driver) DeleteDataset(name string) error
- func (driver Driver) Deregister()
- func (driver Driver) Destroy()
- func (driver Driver) LongName() string
- func (object *Driver) MetadataItem(name, domain string) string
- func (driver Driver) Register() int
- func (driver Driver) RenameDataset(newName, oldName string) error
- func (driver Driver) ShortName() string
- type ErrorHandler
- type ErrorLevel
- type ErrorNumber
- type GDALTranslateOptions
- type GDALWarpAppOptions
- type MajorObject
- func (object MajorObject) Description() string
- func (object MajorObject) Metadata(domain string) []string
- func (object MajorObject) MetadataItem(name, domain string) string
- func (object MajorObject) SetDescription(desc string)
- func (object MajorObject) SetMetadata(metadata []string, domain string)
- func (object MajorObject) SetMetadataItem(name, value, domain string)
- type OpenFlag
- type PaletteInterp
- type ProgressFunc
- type RATFieldType
- type RATFieldUsage
- type RWFlag
- type RasterAttributeTable
- func (rat RasterAttributeTable) ColOfUsage(rfu RATFieldUsage) int
- func (rat RasterAttributeTable) ColumnCount() int
- func (rat RasterAttributeTable) CreateColumn(name string, rft RATFieldType, rfu RATFieldUsage) error
- func (rat RasterAttributeTable) Destroy()
- func (rat RasterAttributeTable) FromColorTable(ct ColorTable) error
- func (rat RasterAttributeTable) LinearBinning() (row0min, binsize float64, exists bool)
- func (rat RasterAttributeTable) NameOfCol(index int) string
- func (rat RasterAttributeTable) RowCount() int
- func (rat RasterAttributeTable) RowOfValue(val float64) (int, bool)
- func (rat RasterAttributeTable) SetLinearBinning(row0min, binsize float64) error
- func (rat RasterAttributeTable) SetRowCount(count int)
- func (rat RasterAttributeTable) SetValueAsFloat64(row, field int, val float64)
- func (rat RasterAttributeTable) SetValueAsInt(row, field, val int)
- func (rat RasterAttributeTable) SetValueAsString(row, field int, val string)
- func (rat RasterAttributeTable) ToColorTable(count int) ColorTable
- func (rat RasterAttributeTable) TypeOfCol(index int) RATFieldType
- func (rat RasterAttributeTable) UsageOfCol(index int) RATFieldUsage
- func (rat RasterAttributeTable) ValueAsFloat64(row, field int) float64
- func (rat RasterAttributeTable) ValueAsInt(row, field int) int
- func (rat RasterAttributeTable) ValueAsString(row, field int) string
- type RasterBand
- func (rasterBand RasterBand) AdviseRead(xOff, yOff, xSize, ySize, bufXSize, bufYSize int, dataType DataType, ...) error
- func (rasterBand RasterBand) BandNumber() int
- func (rasterBand RasterBand) BlockSize() (int, int)
- func (rasterBand RasterBand) CategoryNames() []string
- func (rasterBand RasterBand) ColorInterp() ColorInterp
- func (rasterBand RasterBand) ColorTable() ColorTable
- func (rasterBand RasterBand) ComputeMinMax(approxOK int) (min, max float64)
- func (rasterBand RasterBand) ComputeStatistics(approxOK int, progress ProgressFunc, data interface{}) (min, max, mean, stdDev float64)
- func (rasterBand RasterBand) CreateMaskBand(flags int) error
- func (rasterBand RasterBand) DefaultHistogram(force int, progress ProgressFunc, data interface{}) (min, max float64, buckets int, histogram []int, err error)
- func (rasterBand RasterBand) Fill(real, imaginary float64) error
- func (rasterBand RasterBand) FlushCache()
- func (rasterBand RasterBand) GetAccess() Access
- func (rasterBand RasterBand) GetDataset() Dataset
- func (rasterBand RasterBand) GetDefaultRAT() RasterAttributeTable
- func (rasterBand RasterBand) GetMaskBand() RasterBand
- func (rasterBand RasterBand) GetMaskFlags() int
- func (rasterBand RasterBand) GetMaximum() (val float64, valid bool)
- func (rasterBand RasterBand) GetMinimum() (val float64, valid bool)
- func (rasterBand RasterBand) GetOffset() (float64, bool)
- func (rasterBand RasterBand) GetScale() (float64, bool)
- func (rasterBand RasterBand) GetStatistics(approxOK, force int) (min, max, mean, stdDev float64)
- func (rasterBand RasterBand) GetUnitType() string
- func (rasterBand RasterBand) HasArbitraryOverviews() int
- func (rasterBand RasterBand) Histogram(min, max float64, buckets int, includeOutOfRange, approxOK int, ...) ([]int, error)
- func (rasterBand RasterBand) IO(rwFlag RWFlag, xOff, yOff, xSize, ySize int, buffer interface{}, ...) error
- func (object *RasterBand) MetadataItem(name, domain string) string
- func (rasterBand RasterBand) NoDataValue() (val float64, valid bool)
- func (rasterBand RasterBand) Overview(level int) RasterBand
- func (rasterBand RasterBand) OverviewCount() int
- func (sourceRaster RasterBand) RasterBandCopyWholeRaster(destRaster RasterBand, options []string, progress ProgressFunc, ...) error
- func (rasterBand RasterBand) RasterDataType() DataType
- func (rasterBand RasterBand) ReadBlock(xOff, yOff int, dataPtr unsafe.Pointer) error
- func (rasterBand RasterBand) SetColorInterp(colorInterp ColorInterp) error
- func (rasterBand RasterBand) SetColorTable(colorTable ColorTable) error
- func (rasterBand RasterBand) SetDefaultRAT(rat RasterAttributeTable) error
- func (rasterBand *RasterBand) SetMetadataItem(name, value, domain string) error
- func (rasterBand RasterBand) SetNoDataValue(val float64) error
- func (rasterBand RasterBand) SetOffset(offset float64) error
- func (rasterBand RasterBand) SetRasterCategoryNames(names []string) error
- func (rasterBand RasterBand) SetScale(scale float64) error
- func (rasterBand RasterBand) SetStatistics(min, max, mean, stdDev float64) error
- func (rasterBand RasterBand) SetUnitType(unit string) error
- func (rasterBand RasterBand) WriteBlock(xOff, yOff int, dataPtr unsafe.Pointer) error
- func (rasterBand RasterBand) XSize() int
- func (rasterBand RasterBand) YSize() int
- type ResampleAlg
- type VSILFILE
Constants ¶
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) )
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) )
const ( AR_Pending = AsyncStatusType(C.GARIO_PENDING) AR_Update = AsyncStatusType(C.GARIO_UPDATE) AR_Error = AsyncStatusType(C.GARIO_ERROR) AR_Complete = AsyncStatusType(C.GARIO_COMPLETE) )
const ( // Read only (no update) access ReadOnly = Access(C.GA_ReadOnly) // Read/write access. Update = Access(C.GA_Update) )
const ( // Read data Read = RWFlag(C.GF_Read) // Write data Write = RWFlag(C.GF_Write) )
const ( OFReadOnly = OpenFlag(C.GDAL_OF_READONLY) OFUpdate = OpenFlag(C.GDAL_OF_UPDATE) OFVector = OpenFlag(C.GDAL_OF_VECTOR) OFRaster = OpenFlag(C.GDAL_OF_RASTER) OFVerbose_Error = OpenFlag(C.GDAL_OF_VERBOSE_ERROR) )
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) )
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) )
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.
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) )
const ( GRA_NearestNeighbour = ResampleAlg(0) GRA_Bilinear = ResampleAlg(1) GRA_Cubic = ResampleAlg(2) GRA_CubicSpline = ResampleAlg(3) GRA_Lanczos = ResampleAlg(4) )
const ( GFT_Integer = RATFieldType(C.GFT_Integer) GFT_Real = RATFieldType(C.GFT_Real) GFT_String = RATFieldType(C.GFT_String) )
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 ¶
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 CUIntBigSliceToInt ¶ added in v0.0.5
func CreateScaledProgress ¶
func DestroyScaledProgress ¶
func DummyProgress ¶
func InstallErrorHandler ¶ added in v0.0.3
func InstallErrorHandler(eh ErrorHandler)
InstallErrorHandler installs eh as the current error handler.
func IntSliceToCInt ¶
func InvGeoTransform ¶
Invert the supplied transform
func ScaledProgress ¶
func TermProgress ¶
func VSIMkdir ¶ added in v0.0.5
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
Create a directory and all its ancestors.
func VSIReadDirRecursive ¶ added in v0.0.5
List VSI files
func VSIRmdir ¶ added in v0.0.5
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
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.
Types ¶
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) CreateColorRamp ¶
func (ct ColorTable) CreateColorRamp(start, end int, startColor, endColor ColorEntry)
Create color ramp
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 Dataset ¶
type Dataset struct {
// contains filtered or unexported fields
}
func GDALTranslate ¶ added in v0.0.5
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 ¶
Open a shared existing dataset
func VectorTranslate ¶ added in v0.0.5
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) CopyWholeRaster ¶
func (sourceDataset Dataset) CopyWholeRaster( destDataset Dataset, options []string, progress ProgressFunc, data interface{}, ) error
Copy all dataset raster data
func (Dataset) CreateMaskBand ¶
Adds a mask band to the dataset
func (Dataset) GDALDereferenceDataset ¶
Subtract one from dataset reference count
func (Dataset) GDALGetInternalHandle ¶
Fetch a format specific internally meaningful handle
func (Dataset) GDALReferenceDataset ¶
Add one to dataset reference count
func (Dataset) GeoTransform ¶
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 ¶
Return the inverted transform
func (*Dataset) MetadataItem ¶ added in v0.0.5
func (Dataset) Projection ¶
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 ¶
Fetch the number of raster bands in the dataset
func (Dataset) SetGeoTransform ¶
Set the affine transformation coefficients
func (*Dataset) SetMetadataItem ¶
func (Dataset) SetProjection ¶
Set the projection reference string
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func GetDriverByName ¶
Return the driver by short name
func IdentifyDriver ¶
Return the driver needed to access the provided dataset name.
func (Driver) CopyDatasetFiles ¶
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 ¶
Delete named dataset
func (*Driver) MetadataItem ¶
Fetch single metadata item.
func (Driver) RenameDataset ¶
Rename named dataset
type ErrorHandler ¶ added in v0.0.3
type ErrorHandler func(ErrorLevel, ErrorNumber, string)
ErrorHandler models a callback for error messages.
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 PaletteInterp ¶
type PaletteInterp int
Types of color interpretations for a GDALColorTable.
func (PaletteInterp) Name ¶
func (paletteInterp PaletteInterp) Name() string
type ProgressFunc ¶
type RATFieldType ¶
type RATFieldType int
type RATFieldUsage ¶
type RATFieldUsage int
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) 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) 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
type ResampleAlg ¶
type ResampleAlg int