diff --git a/doc_test.go b/doc_test.go index 6f91029..084a0e0 100644 --- a/doc_test.go +++ b/doc_test.go @@ -289,6 +289,14 @@ func Example_rasterTutorial() { poDstDS.Bands()[0].Write(0, 0, abyRaster, 512, 512) poDstDS.Close() + if godal.Int8 != -1 { // Test valid for gdal > 3.7.0 + poDstDSInt8, _ := godal.Create(godal.GTiff, pszDstFilename, 1, godal.Int8, 512, 512) + defer poDstDSInt8.Close() //Close can be defered / called more than once (second+ calls are no-ops) + + // ... now populate with data + poDstDSInt8.Bands()[0].Write(0, 0, abyRaster, 512, 512) + poDstDSInt8.Close() + } // Output: // Size is 10x10x3 // Projection is 'GEOGCS["WGS 84",DATU...' diff --git a/godal.go b/godal.go index b205e54..e142677 100644 --- a/godal.go +++ b/godal.go @@ -45,6 +45,8 @@ const ( Byte = DataType(C.GDT_Byte) //UInt16 DataType UInt16 = DataType(C.GDT_UInt16) + //Int8 DataType + Int8 = DataType(C.GDT_Int8) //Int16 DataType Int16 = DataType(C.GDT_Int16) //UInt32 DataType diff --git a/godal.h b/godal.h index f7d5a79..c4351dc 100644 --- a/godal.h +++ b/godal.h @@ -25,6 +25,10 @@ #if GDAL_VERSION_NUM < 3000000 #error "this code is only compatible with gdal version >= 3.0" +#elif GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(3, 7, 0) +typedef enum { + /*! 8-bit signed integer (GDAL >= 3.7) */ GDT_Int8 = -1 +} FutureGDALDataType; #endif #ifdef __cplusplus