[GRASS-user] Converting slopes from huge DEM into vector (area)

Hi

I have a huge raster, representing the slopes of a huge DEM (Rows: 25960, Columns: 23211, Total Cells: 602557560, Type CELL).
I would like to use R.to.vect to convert it to a vector layer of type area. Due to memory requirements, it does not work in one step.

I thought of splitting the raster into several smaller rasters (let's say into 100 smaller rasters of the same resolution) for which I could use r.to.vect to create the vector layers and in a final step patch the vector layers together again.

Before going into the details: is this a feasible approach (I can't reduce the resolution as the resolution is needed) or is there another solution?

But I am stuck in the first step:
how can I split one large raster layer into several smaller?

and:
What is the easiest way to write the script to do the calculations for all 100 raster layers? (I haven't used the scripting in GRASS 6.2.1 yet, but I have done a bit scripting under the bash shell)

Any help is welcome,

Rainer

--
NEW EMAIL ADDRESS AND ADDRESS:

Rainer.Krug@uct.ac.za

RKrug@sun.ac.za WILL BE DISCONTINUED END OF MARCH

Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Leslie Hill Institute for Plant Conservation
University of Cape Town
Rondebosch 7701
South Africa

Fax: +27 - (0)86 516 2782
Fax: +27 - (0)21 650 2440 (w)
Cell: +27 - (0)83 9479 042

Skype: RMkrug

email: Rainer.Krug@uct.ac.za
         Rainer@krugs.de

Rainer M. Krug wrote:

I have a huge raster, representing the slopes of a huge DEM (Rows:
   25960, Columns: 23211, Total Cells: 602557560, Type CELL).
I would like to use R.to.vect to convert it to a vector layer of type
area. Due to memory requirements, it does not work in one step.

I thought of splitting the raster into several smaller rasters (let's
say into 100 smaller rasters of the same resolution) for which I could

you probably only need to split it into 4 parts, not 100.

use r.to.vect to create the vector layers and in a final step patch
the vector layers together again.

Before going into the details: is this a feasible approach (I can't
reduce the resolution as the resolution is needed)

sure. use v.patch to recombine the parts, but mind the attributes carry
through.

or is there another solution?

probably several

But I am stuck in the first step:
how can I split one large raster layer into several smaller?

actually you don't need to, just change the region with g.region.
Raster ops only happen in the current region. set the north/south
bounds to a quarter of the map's height and then r.to.vect will
only work on that part of it. Vector ops (for the most part) ignore
the current region settings.

and:
What is the easiest way to write the script to do the calculations for
all 100 raster layers? (I haven't used the scripting in GRASS 6.2.1
yet, but I have done a bit scripting under the bash shell)

for MAP in `g.mlist type=rast pattern=*` ; do
   echo "[$MAP]"
   g.region rast=$MAP
   r.to.vect $MAP ....
done

Hamish

Hi Hamish

thanks a lot for your information - I'll try it out and come back if I have further problems

Rainer

Hamish wrote:

Rainer M. Krug wrote:

I have a huge raster, representing the slopes of a huge DEM (Rows: 25960, Columns: 23211, Total Cells: 602557560, Type CELL).
I would like to use R.to.vect to convert it to a vector layer of type area. Due to memory requirements, it does not work in one step.

I thought of splitting the raster into several smaller rasters (let's say into 100 smaller rasters of the same resolution) for which I could

you probably only need to split it into 4 parts, not 100.

use r.to.vect to create the vector layers and in a final step patch
the vector layers together again.

Before going into the details: is this a feasible approach (I can't reduce the resolution as the resolution is needed)

sure. use v.patch to recombine the parts, but mind the attributes carry
through.

or is there another solution?

probably several

But I am stuck in the first step:
how can I split one large raster layer into several smaller?

actually you don't need to, just change the region with g.region.
Raster ops only happen in the current region. set the north/south
bounds to a quarter of the map's height and then r.to.vect will
only work on that part of it. Vector ops (for the most part) ignore
the current region settings.

and:
What is the easiest way to write the script to do the calculations for
all 100 raster layers? (I haven't used the scripting in GRASS 6.2.1
yet, but I have done a bit scripting under the bash shell)

for MAP in `g.mlist type=rast pattern=*` ; do
   echo "[$MAP]"
   g.region rast=$MAP
   r.to.vect $MAP ....
done

Hamish

--
NEW EMAIL ADDRESS AND ADDRESS:

Rainer.Krug@uct.ac.za

RKrug@sun.ac.za WILL BE DISCONTINUED END OF MARCH

Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Leslie Hill Institute for Plant Conservation
University of Cape Town
Rondebosch 7701
South Africa

Fax: +27 - (0)86 516 2782
Fax: +27 - (0)21 650 2440 (w)
Cell: +27 - (0)83 9479 042

Skype: RMkrug

email: Rainer.Krug@uct.ac.za
         Rainer@krugs.de