[GRASS-user] From Vector to raster

Moritz Lennert mlennert at club.worldonline.be
Tue Nov 6 00:54:26 PST 2018


On 06/11/18 09:34, francesco sapienza wrote:
> Hello! i'm having problems in the simple task of convert a vector to a 
> raster. I have obteined my vector polygon starting from 2d points in my 
> map (v.hull) i can see the new polygon and now i want to create a raster 
> with "1" values inside the area and null values outside. I used 
> [v.to.rast] to do that, specifing as input feature type only area and as 
> raster value (for use=val) "1". Everything seems to work but when i 
> question the map i find that both inside and outside my polygon instead 
> than "0" and "1" i have "no values"
> (must say that im a beginner). thanks a lot for the help!!

You probably have to set the computational region first. This determines 
the grid in which any new raster is written, both its extent and its 
resolution (see [1] for a bit more information).

Depending on the size of the area covered and the resolution desired, 
you can use something like this:

g.region vect=YourPolygon res=YourDesiredResolution [-a if you want to 
make sure to get precisely this resolution, and have the extents widened 
to fit to this resolution  - see g.region manual page for details]

Then try v.to.rast.

Moritz


[1] https://grass.osgeo.org/grass74/manuals/rasterintro.html


More information about the grass-user mailing list