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

[Bug] GDAL VRT with Int8 data type fail to import #4230

Open
ninsbl opened this issue Aug 26, 2024 · 2 comments
Open

[Bug] GDAL VRT with Int8 data type fail to import #4230

ninsbl opened this issue Aug 26, 2024 · 2 comments
Labels
backport to 8.4 PR needs to be backported to release branch 8.4 bug Something isn't working C Related code is in C libraries raster Related to raster data processing
Milestone

Comments

@ninsbl
Copy link
Member

ninsbl commented Aug 26, 2024

Describe the bug

r.in.gdal and r.external fail to import GDAL Virtual Rasters (VRT) with Int8 datatype.
Int8 was relatively recently introduced to GDAL (3.7) and then made available in VRT datasets.
While GRASS GIS reads Int8 data in GeoTiff format, it fails with that datatype in VRT format.

To reproduce

# Create a Int8 raster in GeoTiff
gdal_create -ot Int8 -of GTiff -outsize 24 24 -burn 1 -a_srs EPSG:25833 -a_ullr 0 24 24 0 ./test.tif
# Create a VRT from it
gdal_translate -of VRT ./test.tif ./test.vrt
# Import the GeoTiff (works)
r.in.gdal -o input=test.tif output=test.tif
# Try to import the VRT (fails)
r.in.gdal -o input=test.vrt output=test.vrt
r.external -o input=test.vrt output=test.vrt

The last two commands fail with:

ERROR 1: Invalid dataType = Int8
ERROR: Unable to open datasource <test.vrt>

Expected behavior

GRASS GIS should import VRT with Int8 data.

System description

  • Ubuntu 22.04
  • GRASS GIS version: 8.4
  • GDAL 3.7

Additional context

GRASS GIS does not seem to be the only one here:
https://community.safe.com/data-7/int8-gdal-vrt-raster-not-supported-by-fme-18505

@ninsbl ninsbl added bug Something isn't working raster Related to raster data processing C Related code is in C libraries labels Aug 26, 2024
@ninsbl ninsbl added this to the 8.4.1 milestone Aug 26, 2024
@neteler
Copy link
Member

neteler commented Aug 27, 2024

I guess it is "easy" to fix by adding GDT_Int8 support here (possibly with a test for the minimum required GDAL version, i.e. 3.7):

switch (info->gdal_type) {

@neteler neteler modified the milestones: 8.4.1, 8.5.0 Aug 27, 2024
@neteler neteler added the backport to 8.4 PR needs to be backported to release branch 8.4 label Aug 27, 2024
@ninsbl ninsbl modified the milestones: 8.5.0, 8.4.1 Oct 24, 2024
@nilason
Copy link
Contributor

nilason commented Nov 7, 2024

Is this solved by #4256?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport to 8.4 PR needs to be backported to release branch 8.4 bug Something isn't working C Related code is in C libraries raster Related to raster data processing
Projects
None yet
Development

No branches or pull requests

5 participants
@neteler @ninsbl @nilason and others