[GRASS-user] Import a catalog of ascii *.arc files and merge to a raster

Hi!
I want to import a set (20) of ESRI ASCII raster files in a catalog, and merge them to a single GRASS raster dataset.

How do I do that? (Yes I can import each file, and then merge (r.patch), but..)

Regards larsf

Thanks Daniel.

But no, I was not able to make your suggestion work; it complains that it dos not know the command ‘For’…

Regards larsf

Den 01. april 2012 16:01, skrev Daniel Victoria:

I believe there is a batch import function in the gui ( I’m not in front of my computer now). If not, you can write a for loop in the command line to import all files.
In Linux shell it’s something like
For i in *.arc
Do r.in.arc $i
Done

Daniel

On Apr 1, 2012 10:13 AM, “Lars Forseth” <lars.forseth@ntebb.no> wrote:

Hi!
I want to import a set (20) of ESRI ASCII raster files in a catalog, and merge them to a single GRASS raster dataset.

How do I do that? (Yes I can import each file, and then merge (r.patch), but…)

Regards larsf


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Lars Forseth wrote:

Thanks Daniel.

But no, I was not able to make your suggestion work; it complains that it
dos not know the command 'For'...

In Linux shell and msys this must be lowercase, i.e.

for i in *.arc
do r.in.arc $i <output name here>
done

or

for i in *.arc
do r.in.arc in=$i out=`basename $i .arc`
done

followed by something like

raster_list=`g.mlist type=rast pat=<insert search pattern here> sep=comma`
g.region -p rast=$raster_list
r.patch in=$raster_list out=<output name here>

HTH,

Markus M

Regards larsf

Den 01. april 2012 16:01, skrev Daniel Victoria:

I believe there is a batch import function in the gui ( I'm not in front of
my computer now). If not, you can write a for loop in the command line to
import all files.
In Linux shell it's something like
For i in *.arc
Do r.in.arc $i <output name here>
Done

Daniel

On Apr 1, 2012 10:13 AM, "Lars Forseth" <lars.forseth@ntebb.no> wrote:

Hi!
I want to import a set (20) of ESRI ASCII raster files in a catalog, and
merge them to a single GRASS raster dataset.

How do I do that? (Yes I can import each file, and then merge (r.patch),
but..)

Regards larsf

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Hi!
In help for r.patch I found this:

MAPS=`g.mlist type=rast sep=, pat="map_*"`
g.region rast=$MAPS
r.patch in=$MAPS out=mosaic

That worked for me now.

I importet all files in the catalog by defining import source in the gui for r.in.gdal as directory; choosing the right directory; and it then imported all the files, giving them a "prefix" of x2; or some such.

I shall try Markus suggestions next!

regards; and thanks!

larsf

Den 01. april 2012 18:42, skrev Markus Metz:

Lars Forseth wrote:

Thanks Daniel.

But no, I was not able to make your suggestion work; it complains that it
dos not know the command 'For'...

In Linux shell and msys this must be lowercase, i.e.

for i in *.arc
do r.in.arc $i<output name here>
done

or

for i in *.arc
do r.in.arc in=$i out=`basename $i .arc`
done

followed by something like

raster_list=`g.mlist type=rast pat=<insert search pattern here> sep=comma`
g.region -p rast=$raster_list
r.patch in=$raster_list out=<output name here>

HTH,

Markus M

Regards larsf

Den 01. april 2012 16:01, skrev Daniel Victoria:

I believe there is a batch import function in the gui ( I'm not in front of
my computer now). If not, you can write a for loop in the command line to
import all files.
In Linux shell it's something like
For i in *.arc
Do r.in.arc $i<output name here>
Done

Daniel

On Apr 1, 2012 10:13 AM, "Lars Forseth"<lars.forseth@ntebb.no> wrote:

Hi!
I want to import a set (20) of ESRI ASCII raster files in a catalog, and
merge them to a single GRASS raster dataset.

How do I do that? (Yes I can import each file, and then merge (r.patch),
but..)

Regards larsf

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Sun, Apr 1, 2012 at 2:43 PM, Lars Forseth <lars.forseth@ntebb.no> wrote:

Hi!
I want to import a set (20) of ESRI ASCII raster files in a catalog, and
merge them to a single GRASS raster dataset.

How do I do that? (Yes I can import each file, and then merge (r.patch),
but..)

Just FYI, there is also graphical bulk import:

http://grass.osgeo.org/wiki/Importing_data#Importing_multiple_raster_.28e.g..2C_GeoTIFF.29_files
--> screenshots

cheers
Markus