0

I am going to use r.fill.dir on an area. The downloaded data comes as a set of tiles that puzzle together.

Screenshot of raw data visualized

In order to delineate watershed across tiles I need to merge them to a complete raster.

Screenshot of merged raster

After merging the raster I need to run the r.fill.dir tool. Here I run into problems to which I can not find an answer to anywhere. I get following error in the log:

    QGIS version: 3.24.0-Tisler
QGIS code revision: 6b44a42058
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.4.1
GEOS version: 3.10.2-CAPI-1.16.0
PROJ version: Rel. 8.2.1, January 1st, 2022
PDAL version: 2.3.0 (git-version: 9f35b7)
Algorithm started at: 2022-03-07T14:19:53
Algorithm 'r.fill.dir' starting…
Input parameters:
{ '-f' : False, 'GRASS_RASTER_FORMAT_META' : '', 'GRASS_RASTER_FORMAT_OPT' : '', 'GRASS_REGION_CELLSIZE_PARAMETER' : 0, 'GRASS_REGION_PARAMETER' : None, 'areas' : 'TEMPORARY_OUTPUT', 'direction' : 'TEMPORARY_OUTPUT', 'format' : 0, 'input' : 'C:/Users/frsu0056/AppData/Local/Temp/processing_aUtVhQ/b8eb3cff568142d8bdb99bcd81c5c790/OUTPUT.tif', 'output' : 'TEMPORARY_OUTPUT' }

g.proj -c wkt="C:/Users/frsu0056/AppData/Local/Temp/processing_aUtVhQ/9efd79281f8648949389db819d1fbb8a/crs.prj"
r.in.gdal input="C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\b8eb3cff568142d8bdb99bcd81c5c790\OUTPUT.tif" band=1 output="rast_6226067a034f92" --overwrite -o
g.region n=7605000.0 s=7592500.0 e=652500.0 w=627500.0 res=2.0
r.fill.dir input=rast_6226067a034f92 format="grass" output=output10df3761d73c4138a4b4e5aaed7497c5 direction=direction10df3761d73c4138a4b4e5aaed7497c5 areas=areas10df3761d73c4138a4b4e5aaed7497c5 --overwrite
g.region raster=output10df3761d73c4138a4b4e5aaed7497c5
r.out.gdal -t -m input="output10df3761d73c4138a4b4e5aaed7497c5" output="C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\d37832c615b444a387a8f04a982abf88\output.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
g.region raster=direction10df3761d73c4138a4b4e5aaed7497c5
r.out.gdal -t -m input="direction10df3761d73c4138a4b4e5aaed7497c5" output="C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\1934a9b598d24989bc5d21ab4dc9a8e3\direction.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
g.region raster=areas10df3761d73c4138a4b4e5aaed7497c5
r.out.gdal -t -m input="areas10df3761d73c4138a4b4e5aaed7497c5" output="C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\2f99ed5b0f2340798d0251947bb61400\areas.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
Starting GRASS GIS...
WARNING: Concurrent mapset locking is not supported on Windows
Cleaning up temporary files...
Executing <C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\grassdata\grass_batch_job.cmd> ...
C:\Users\frsu0056\Documents>chcp 1252 1>NUL
C:\Users\frsu0056\Documents>g.proj -c wkt="C:/Users/frsu0056/AppData/Local/Temp/processing_aUtVhQ/9efd79281f8648949389db819d1fbb8a/crs.prj"
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default
Projection information updated
C:\Users\frsu0056\Documents>r.in.gdal input="C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\b8eb3cff568142d8bdb99bcd81c5c790\OUTPUT.tif" band=1 output="rast_6226067a034f92" --overwrite -o
Over-riding projection check
Importing raster map <rast_6226067a034f92>...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
C:\Users\frsu0056\Documents>g.region n=7605000.0 s=7592500.0 e=652500.0 w=627500.0 res=2.0
C:\Users\frsu0056\Documents>r.fill.dir input=rast_6226067a034f92 format="grass" output=output10df3761d73c4138a4b4e5aaed7497c5 direction=direction10df3761d73c4138a4b4e5aaed7497c5 areas=areas10df3761d73c4138a4b4e5aaed7497c5 --overwrite
C:\Users\frsu0056\Documents>g.region raster=output10df3761d73c4138a4b4e5aaed7497c5
ERROR: Raster map <output10df3761d73c4138a4b4e5aaed7497c5> not found
C:\Users\frsu0056\Documents>r.out.gdal -t -m input="output10df3761d73c4138a4b4e5aaed7497c5" output="C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\d37832c615b444a387a8f04a982abf88\output.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
ERROR: Raster map or group <output10df3761d73c4138a4b4e5aaed7497c5> not found
C:\Users\frsu0056\Documents>g.region raster=direction10df3761d73c4138a4b4e5aaed7497c5
ERROR: Raster map <direction10df3761d73c4138a4b4e5aaed7497c5> not found
C:\Users\frsu0056\Documents>r.out.gdal -t -m input="direction10df3761d73c4138a4b4e5aaed7497c5" output="C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\1934a9b598d24989bc5d21ab4dc9a8e3\direction.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
ERROR: Raster map or group <direction10df3761d73c4138a4b4e5aaed7497c5> not found
C:\Users\frsu0056\Documents>g.region raster=areas10df3761d73c4138a4b4e5aaed7497c5
ERROR: Raster map <areas10df3761d73c4138a4b4e5aaed7497c5> not found
C:\Users\frsu0056\Documents>r.out.gdal -t -m input="areas10df3761d73c4138a4b4e5aaed7497c5" output="C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\2f99ed5b0f2340798d0251947bb61400\areas.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
ERROR: Raster map or group <areas10df3761d73c4138a4b4e5aaed7497c5> not found
C:\Users\frsu0056\Documents>exit
Execution of <C:\Users\frsu0056\AppData\Local\Temp\processing_aUtVhQ\grassdata\grass_batch_job.cmd> finished.
Cleaning up temporary files...
Press any key to continue . . .
Execution completed in 55.57 seconds
Results:
{'areas': 'C:\\Users\\frsu0056\\AppData\\Local\\Temp\\processing_aUtVhQ\\2f99ed5b0f2340798d0251947bb61400\\areas.tif',
'direction': 'C:\\Users\\frsu0056\\AppData\\Local\\Temp\\processing_aUtVhQ\\1934a9b598d24989bc5d21ab4dc9a8e3\\direction.tif',
'output': 'C:\\Users\\frsu0056\\AppData\\Local\\Temp\\processing_aUtVhQ\\d37832c615b444a387a8f04a982abf88\\output.tif'}

Loading resulting layers
The following layers were not correctly generated.
• C:/Users/frsu0056/AppData/Local/Temp/processing_aUtVhQ/1934a9b598d24989bc5d21ab4dc9a8e3/direction.tif
• C:/Users/frsu0056/AppData/Local/Temp/processing_aUtVhQ/2f99ed5b0f2340798d0251947bb61400/areas.tif
• C:/Users/frsu0056/AppData/Local/Temp/processing_aUtVhQ/d37832c615b444a387a8f04a982abf88/output.tif
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

I have troubleshooted this error and figured out that:

  1. Saving the merged map to a GeoTIFF and opening it in a new project does not make a difference
  2. Running r.fill.dir on a single tile works fine, so does running the tool on two merged tiles, but never the whole thing together.

The properties are almost identical, with directories etc., the main difference between these are that the merged raster has "n/a" under "Bands" in properties whereas the individual tile has -9999.

Any ideas?

1 Answer 1

0

I'm by no means an expert, but have you tried creating a virtual raster instead of merging? Because a virtual raster is a catalogue of individual tiles, and fill works on individual tiles, this might work.

raster>miscellaneous>build virtual raster, I suspect you will need to untick 'place each input file into a separate band'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.