1

I have elevation rasters which loaded just fine in a GRASS session. They represent adjacent areas, so I want to meld them into one raster.

I ran r.patch using the GRASS GUI, and it would only accept one input raster at a time in the input files field. So I used the command line in a terminal window. The result was an error message saying that the rasters: cannot be found -- the directory does not exist.

To run r.patch, do the input files have to reside in the Location folder I'm using for the GRASS session? That doesn't seem right. GRASS had no problem finding the same files to simply load them into the map window.

I'm running GRASS on Ubuntu machines (11.10 Oneiric Ocelot).

1
  • Oh -- maybe GRASS did not like the file path symbology. I just copied the file path for each raster and pasted into the command line. Does a normal file path (with ' / ' between folder names) not work in GRASS commands in terminal windows?
    – Catlike
    Apr 6, 2012 at 3:09

1 Answer 1

3

The maps have to reside in the same location but not necessarily in the same mapset(s). Use g.mapsets to add mapsets to the search path if not in the current mapset.

As input, r.patch accepts a comma separated list (without white space). As a first step, we need to set the computation region to all raster maps (in GRASS the current = computation region defines the settings of raster map operations, i.e. spatial extent and resolution).

Example:

g.region rast=raster1,raster2,raster3 -p

r.patch in=raster1,raster2,raster3 out=mosaic

2
  • In your example, why do you have the line "g.region rast=raster1,raster2,raster3 -p" ? What is the purpose of that? I see in GRASS manual that "g.region" with the "-p" is to show the current region. Why do we need that here? Thank you.
    – Catlike
    Apr 11, 2012 at 8:56
  • 1
    Please enjoy the r.patch manual :) but I'll edit my posting...
    – markusN
    Apr 11, 2012 at 18:31

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.