Hello everybody on the list!
I am a “occasional” grass gis user and I’m stuck with a relatively simple task: I have a high-res vector layer describing only one category (Corine Land Cover map for “broad-leaved forests”, 311) and I want to rasterise it in a low-res 8-by-8 km raster map where the value stored on each cell is the area (or, that’s the same, the share of the area) that the vector cover within that cell.
So each pixel/cell would have a value ranging from 0 (no broad-leaved forest at all) to 64 (all the area of the pixel is covered by broaded-leaved forests).
I already managed to get the region with the right cell dimension, add the area geometry to the vector and load it in grass, but I don’t know now how to rasterize it (v.to.raster seems to me to not offer the option to put the area, but only a specific catgegory, but maybe I am wrong??).
Thank you for any hint you could provide me.
Antonello
–
Antonello Lobianco
INRA, Laboratoire d’Economie Forestière
14 Rue Girardet - 54000 Nancy, France
Tel: +33.652392310
Email: antonello.lobianco@nancy-engref.inra.fr
http://antonello.lobianco.org
Hi Antonello,
I would first make a field for the area in the vector attribute table with v.db.addcol, then compute the area of each vector with v.to.db and store it in the attribute table. Then I’d convert the vectors to rasters using the parameter “use=attr” and tell GRASS to use the area column as the cell values. Hope that helps!
Daniel
–
B.Sc. Daniel Lee
Geschäftsführung für Forschung und Entwicklung
ISIS - International Solar Information Solutions GbR
Vertreten durch: Daniel Lee, Nepomuk Reinhard und Nils Räder
Softwarecenter 3
35037 Marburg
Festnetz: +49 6421 379 6256
Mobil: +49 176 6127 7269
E-Mail: Lee@isi-solutions.org
Web: http://www.isi-solutions.org
2012/6/12 Antonello Lobianco <antonello@lobianco.org>
Hello everybody on the list!
I am a “occasional” grass gis user and I’m stuck with a relatively simple task: I have a high-res vector layer describing only one category (Corine Land Cover map for “broad-leaved forests”, 311) and I want to rasterise it in a low-res 8-by-8 km raster map where the value stored on each cell is the area (or, that’s the same, the share of the area) that the vector cover within that cell.
So each pixel/cell would have a value ranging from 0 (no broad-leaved forest at all) to 64 (all the area of the pixel is covered by broaded-leaved forests).
I already managed to get the region with the right cell dimension, add the area geometry to the vector and load it in grass, but I don’t know now how to rasterize it (v.to.raster seems to me to not offer the option to put the area, but only a specific catgegory, but maybe I am wrong??).
Thank you for any hint you could provide me.
Antonello
–
Antonello Lobianco
INRA, Laboratoire d’Economie Forestière
14 Rue Girardet - 54000 Nancy, France
Tel: +33.652392310
Email: antonello.lobianco@nancy-engref.inra.fr
http://antonello.lobianco.org
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
Hello everybody on the list!
I am a “occasional” grass gis user and I’m stuck with a relatively simple task: I have a high-res vector layer describing only one category (Corine Land Cover map for “broad-leaved forests”, 311) and I want to rasterise it in a low-res 8-by-8 km raster map where the value stored on each cell is the area (or, that’s the same, the share of the area) that the vector cover within that cell.
So each pixel/cell would have a value ranging from 0 (no broad-leaved forest at all) to 64 (all the area of the pixel is covered by broaded-leaved forests).
I already managed to get the region with the right cell dimension, add the area geometry to the vector and load it in grass, but I don’t know now how to rasterize it (v.to.raster seems to me to not offer the option to put the area, but only a specific catgegory, but maybe I am wrong??).
I’m not sure what your final goal is, but you can do what you’ve described as follows:
First set resolution to 1 km
g.region -p res=1000
Now rasterize the vector
v.to.rast broad_leaf_vector out=broad_leaf_1km type=area use=val val=1
THis will give you as raster of 1km X 1km with values of 1 where the original vector covered, and null otherwise
Now change resolution to 8km and use r.resamp.stats to resample to your courser region:
g.region -p res=8000
Use the “sum” method of r.resamp.stats to get the values for the new, coarse raster
r.resamp.stats broad_leaf_1km out=broad_leaf_8km method=sum
Should leave you with a new raster of res 8km, and with values 0-64
HTH,
Micha
···
--
Micha Silver
052-3665918
Thank you, this actually worked.
As I actually wanted the value in meters what I did was to create a very hi-res grid with 20 meter resolution and then assign the value 400 in the rasterisation of the vector, to finally resample.
A direct rasterisation of the vector using the area column as attribute as previously suggested instead didn’t work.
Many thanks,
Antonello
2012/6/12 Micha Silver <micha@arava.co.il>
On 12/06/2012 10:18, Antonello Lobianco wrote:
Hello everybody on the list!
I am a “occasional” grass gis user and I’m stuck with a relatively simple task: I have a high-res vector layer describing only one category (Corine Land Cover map for “broad-leaved forests”, 311) and I want to rasterise it in a low-res 8-by-8 km raster map where the value stored on each cell is the area (or, that’s the same, the share of the area) that the vector cover within that cell.
So each pixel/cell would have a value ranging from 0 (no broad-leaved forest at all) to 64 (all the area of the pixel is covered by broaded-leaved forests).
I already managed to get the region with the right cell dimension, add the area geometry to the vector and load it in grass, but I don’t know now how to rasterize it (v.to.raster seems to me to not offer the option to put the area, but only a specific catgegory, but maybe I am wrong??).
I’m not sure what your final goal is, but you can do what you’ve described as follows:
First set resolution to 1 km
g.region -p res=1000
Now rasterize the vector
v.to.rast broad_leaf_vector out=broad_leaf_1km type=area use=val val=1
THis will give you as raster of 1km X 1km with values of 1 where the original vector covered, and null otherwise
Now change resolution to 8km and use r.resamp.stats to resample to your courser region:
g.region -p res=8000
Use the “sum” method of r.resamp.stats to get the values for the new, coarse raster
r.resamp.stats broad_leaf_1km out=broad_leaf_8km method=sum
Should leave you with a new raster of res 8km, and with values 0-64
HTH,
Micha
Thank you for any hint you could provide me.
Antonello
–
Antonello Lobianco
INRA, Laboratoire d’Economie Forestière
14 Rue Girardet - 54000 Nancy, France
Tel: +33.652392310
Email: antonello.lobianco@nancy-engref.inra.fr
http://antonello.lobianco.org
This mail was received via Mail-SeCure System.
_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)
This mail was received via Mail-SeCure System.
--
Micha Silver
052-3665918
–
Antonello Lobianco
INRA, Laboratoire d’Economie Forestière
14 Rue Girardet - 54000 Nancy, France
Tel: +33.652392310
Email: antonello.lobianco@nancy-engref.inra.fr
http://antonello.lobianco.org
On 12/06/12 09:18, Antonello Lobianco wrote:
Hello everybody on the list!
I am a "occasional" grass gis user and I'm stuck with a relatively
simple task: I have a high-res vector layer describing only one category
(Corine Land Cover map for "broad-leaved forests", 311) and I want to
rasterise it in a low-res 8-by-8 km raster map where the value stored on
each cell is the area (or, that's the same, the share of the area) that
the vector cover within that cell.
Just for the record: you could also do the entire operation with vectors (using an SQL attribute backend, e.g. SQLite our PostgreSQL):
- v.mkgrid to make the grid you desire.
- v.overlay to overlay your grid with your CLC map
- calculate areas of resulting polygons
- through SQL, sum area of forst polygons grouping the result by grid id
- join the result to your original grid
- rasterize the grid
Moritz