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

Hamish hamish_nospam at yahoo.com
Thu Apr 26 05:38:14 EDT 2007


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




More information about the grass-user mailing list