Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r.in.gdal/r.external: add basic support for GDALs GDT_Int8 #4256

Merged
merged 13 commits into from
Sep 4, 2024
5 changes: 5 additions & 0 deletions lib/raster/gdal.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <gdal.h>
#endif

#ifndef GDT_Int8
#define GDT_Int8 14
#endif

/*!
\brief Initialization

Expand Down Expand Up @@ -125,6 +129,7 @@ struct GDAL_link *Rast_get_gdal_link(const char *name, const char *mapset)

switch (type) {
case GDT_Byte:
case GDT_Int8:
case GDT_Int16:
case GDT_UInt16:
case GDT_Int32:
Expand Down
7 changes: 7 additions & 0 deletions lib/raster/get_row.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

#include "R.h"

#ifndef GDT_Int8
#define GDT_Int8 14
#endif

static void embed_nulls(int, void *, int, RASTER_MAP_TYPE, int, int);

static int compute_window_row(int fd, int row, int *cellRow)
Expand Down Expand Up @@ -368,6 +372,9 @@ static void gdal_values_int(int fd, const unsigned char *data,
case GDT_Byte:
c[i] = *(GByte *)d;
break;
case GDT_Int8:
c[i] = *(GInt16 *)d;
nilason marked this conversation as resolved.
Show resolved Hide resolved
break;
case GDT_Int16:
c[i] = *(GInt16 *)d;
break;
Expand Down
9 changes: 9 additions & 0 deletions raster/r.external/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include "proto.h"

#ifndef GDT_Int8
#define GDT_Int8 14
#endif

void query_band(GDALRasterBandH hBand, const char *output,
struct Cell_head *cellhd, struct band_info *info)
{
Expand All @@ -30,6 +34,11 @@ void query_band(GDALRasterBandH hBand, const char *output,
cellhd->format = 0;
break;

case GDT_Int8:
info->data_type = CELL_TYPE;
cellhd->format = 1;
break;

case GDT_Int16:
case GDT_UInt16:
info->data_type = CELL_TYPE;
Expand Down
Loading