[GRASS-user] v.to.rast gives empty raster layer

Moritz Lennert mlennert at club.worldonline.be
Wed May 4 04:24:50 EDT 2011


On 04/05/11 08:42, Hanlie Pretorius wrote:
 > Hi Moritz,
 >
 > I'm not sure what you mean by 'Maris' first part of the solution'. I
 > saw only one part to Maris's suggestion (refining the region's
 > resolution) because I said in my initial mail that I had set extents
 > of the region to the contours_20m vector layer. Initially I did have a
 > resolution of 20m and got an empty raster layer as a result.
 >
 > I share Micha's confusion about this. Although it doesn't make much
 > sense to have a 20m cell size (my bad) I would have thought that
 > v.to.rast would still have given me an output.

Rereading the original mail I see this:

>>> 2011/5/2, Hanlie Pretorius<hanlie.pretorius at gmail.com>:
>>>> r.info for the result is:
>>>> | Layer: contours_20m at CDNGI_DEM Date: Mon May 02 14:18:00 2011
>>>> | Mapset: CDNGI_DEM Login of Creator: hanlie
>>>> | Location: SA_Lo_29E
>>>> | DataBase: F:\grassdata
>>>> | Title: Labels ( contours_20m at CDNGI_DEM )
>>>> | Timestamp: none
>>>> |----------------------------------------------------------------------------
>>>>
>>>> |
>>>> | Type of Map: raster Number of Categories: 0
[snip]
>>>> | Rows: 1772
>>>> | Columns: 1750
>>>> | Total Cells: 3101000
>>>> | Projection: Transverse Mercator
>>>> | N: -3121229.69982072 S: -3156672.30728643 Res:
>>>> 20.00147148
>>>> | E: -32474.90929218 W: -67483.27873573 Res: 20.00478254
>>>> | Range of data: min = 1620 max = 2460
[snip]       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>
>>>> As you can see from the number of categories (0), there is no
>>>> information in this raster file.

There are no category values, but there are data values, so your map 
actually is not empty.

What does r.stats contours_20m at CDNGI_DEM give you ?

1) v.to.rast does create category labels by default. If you use the 
'labelcol' parameter, then you get category values.

Example in the NC demo dataset:

v.to.rast elev_ned10m_cont10m out=contours col=level

r.info contours:

Number of Categories: 0
Range of data:    min = 60.000000  max = 150.000000

2) v.to.rast elev_ned10m_cont10m out=contours col=level labelcol=cat

r.info contours:

Number of Categories: 150
Range of data:    min = 60.000000  max = 150.000000

Moritz


More information about the grass-user mailing list