Opened 11 years ago

Closed 11 years ago

#5070 closed defect (invalid)

gdalbuildvrt won't respect -srcnodata value for overlapping rasters

Reported by: jaerobbo Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 1.10.0
Severity: normal Keywords:
Cc:

Description (last modified by jaerobbo)

I've researched and it appears that buildvrt is supposed to be able to resolve overlap areas when no data values are defined for the sources, but I am unable to produce the expected results.

I've tried the following workflow:

  1. Set No data values to -999 for rsters

gdal_translate -ot float32 -of gtiff -a_nodata -999 in_01.tif out_01.tif

gdal_translate -ot float32 -of gtiff -a_nodata -999 in_02.tif out_02.tif

  1. Build VRT with specified source no data value

gdalbuildvrt -srcnodata -999 -hidenodata out.vrt *.tif

Am I doing something wrong, or is this an issue?

Change History (4)

comment:1 by jaerobbo, 11 years ago

Description: modified (diff)

comment:2 by jaerobbo, 11 years ago

Description: modified (diff)

comment:3 by jaerobbo, 11 years ago

Description: modified (diff)

comment:4 by Even Rouault, 11 years ago

Milestone: 1.10.1
Resolution: invalid
Status: newclosed

I strongly suspect that this is due to the order in which the files appear in your VRT. Currently, the files are "drawn" in the order in which they appear in the VRT file.

For example :

even@even-desktop:~/gdal/svn/trunk/gdal$ cat first.asc
ncols        3
nrows        2
xllcorner    10
yllcorner    10
cellsize     1
NODATA_value   -999
 0 -999 3
 0 -999 3

even@even-desktop:~/gdal/svn/trunk/gdal$ cat second.asc
ncols        3
nrows        2
xllcorner    10
yllcorner    10
cellsize     1
NODATA_value   -999
 1 2 -999
 1 2 -999
even@even-desktop:~/gdal/svn/trunk/gdal$ gdalbuildvrt out.vrt first.asc second.asc -q

even@even-desktop:~/gdal/svn/trunk/gdal$ gdal_translate out.vrt /vsistdout/ -q -of aaigrid
ncols        3
nrows        2
xllcorner    10.000000000000
yllcorner    10.000000000000
cellsize     1.000000000000
NODATA_value   -999
 1 2 3
 1 2 3

even@even-desktop:~/gdal/svn/trunk/gdal$ gdalbuildvrt out.vrt second.asc first.asc -q
even@even-desktop:~/gdal/svn/trunk/gdal$ gdal_translate out.vrt /vsistdout/ -q -of aaigrid
ncols        3
nrows        2
xllcorner    10.000000000000
yllcorner    10.000000000000
cellsize     1.000000000000
NODATA_value   -999
 0 2 3
 0 2 3

Note: See TracTickets for help on using tickets.