gdal constant definitions see https gdal orgapirastercapi htmlcppv412gdaldatatype a list of gdal datatypes that are integers lookup values to convert gdal pixel type indices into ctypes objects the gdal bandio works with ctypes arrays to hold data to be written or to hold the space for data to be read into the lookup below helps selecting the right ctypes object for a given gdal pixel type list of resampling algorithms that can be used to warp a gdalraster see https gdal orgapirastercapi htmlcppv415gdalcolorinterp gdal virtual filesystems prefix fixed base path for bufferbased gdal inmemory files should the memory file system take ownership of the buffer freeing it when the file is deleted no gdalraster del will delete the buffer should a vsi file be removed when retrieving its buffer see https gdal org api raster_c_api html _cppv412gdaldatatype unknown or unspecified type eight bit unsigned integer sixteen bit unsigned integer sixteen bit signed integer thirty two bit unsigned integer thirty two bit signed integer thirty two bit floating point sixty four bit floating point complex int16 complex int32 complex float32 complex float64 64 bit unsigned integer gdal 3 5 64 bit signed integer gdal 3 5 8 bit signed integer gdal 3 7 a list of gdal datatypes that are integers lookup values to convert gdal pixel type indices into ctypes objects the gdal band io works with ctypes arrays to hold data to be written or to hold the space for data to be read into the lookup below helps selecting the right ctypes object for a given gdal pixel type list of resampling algorithms that can be used to warp a gdalraster see https gdal org api raster_c_api html _cppv415gdalcolorinterp undefined default value i e not known grayscale paletted red band of rgba image green band of rgba image blue band of rgba image alpha 0 transparent 255 opaque hue band of hls image saturation band of hls image lightness band of hls image cyan band of cmyk image magenta band of cmyk image yellow band of cmyk image black band of cmly image y luminance cb chroma cr chroma also gci_max gdal virtual filesystems prefix fixed base path for buffer based gdal in memory files should the memory file system take ownership of the buffer freeing it when the file is deleted no gdalraster __del__ will delete the buffer should a vsi file be removed when retrieving its buffer
from ctypes import (
    c_double,
    c_float,
    c_int8,
    c_int16,
    c_int32,
    c_int64,
    c_ubyte,
    c_uint16,
    c_uint32,
    c_uint64,
)


GDAL_PIXEL_TYPES = {
    0: "GDT_Unknown",  
    1: "GDT_Byte",  
    2: "GDT_UInt16",  
    3: "GDT_Int16",  
    4: "GDT_UInt32",  
    5: "GDT_Int32",  
    6: "GDT_Float32",  
    7: "GDT_Float64",  
    8: "GDT_CInt16",  
    9: "GDT_CInt32",  
    10: "GDT_CFloat32",  
    11: "GDT_CFloat64",  
    12: "GDT_UInt64",  
    13: "GDT_Int64",  
    14: "GDT_Int8",  
}


GDAL_INTEGER_TYPES = [1, 2, 3, 4, 5, 12, 13, 14]





GDAL_TO_CTYPES = [
    None,
    c_ubyte,
    c_uint16,
    c_int16,
    c_uint32,
    c_int32,
    c_float,
    c_double,
    None,
    None,
    None,
    None,
    c_uint64,
    c_int64,
    c_int8,
]


GDAL_RESAMPLE_ALGORITHMS = {
    "NearestNeighbour": 0,
    "Bilinear": 1,
    "Cubic": 2,
    "CubicSpline": 3,
    "Lanczos": 4,
    "Average": 5,
    "Mode": 6,
}


GDAL_COLOR_TYPES = {
    0: "GCI_Undefined",  
    1: "GCI_GrayIndex",  
    2: "GCI_PaletteIndex",  
    3: "GCI_RedBand",  
    4: "GCI_GreenBand",  
    5: "GCI_BlueBand",  
    6: "GCI_AlphaBand",  
    7: "GCI_HueBand",  
    8: "GCI_SaturationBand",  
    9: "GCI_LightnessBand",  
    10: "GCI_CyanBand",  
    11: "GCI_MagentaBand",  
    12: "GCI_YellowBand",  
    13: "GCI_BlackBand",  
    14: "GCI_YCbCr_YBand",  
    15: "GCI_YCbCr_CbBand",  
    16: "GCI_YCbCr_CrBand",  
}


VSI_FILESYSTEM_PREFIX = "/vsi"


VSI_MEM_FILESYSTEM_BASE_PATH = "/vsimem/"



VSI_TAKE_BUFFER_OWNERSHIP = False


VSI_DELETE_BUFFER_ON_READ = False