[GRASS-user] filling inter-contour area with constant value

Moritz Lennert mlennert at club.worldonline.be
Mon Apr 28 01:45:22 PDT 2014


On 28/04/14 10:12, Venkatesh Raghavan wrote:
> Hi Moritz and Markus,
>
> On 2014/04/28 16:54, Markus Neteler wrote:
>> On Mon, Apr 28, 2014 at 9:46 AM, Moritz Lennert
>> <mlennert at club.worldonline.be> wrote:
>> ...
>>> This stackoverflow question is about colors, not values. Which are you
>>> looking for exactly ?
> Need to fill unique values for inter-contour area between each contour
> interval.
> (was thinking of vector color fill and subsequent saving as raster where
> colors
> could be assigned unique category values)
>>> For values, one option might be playing with r.grow.distance and its
>>> value=
>>> parameter.
> Can you elaborate a bit on how to use r.grow.distance for this
> purpose. My input map would be a contour raster map.

Using r.grow.distance with the value output option gives you a map where 
each pixel has the value of the closest non-null pixel. So, if you have 
10m, 20m, etc contour values you will get areas of 10m, 20m pixel values 
centered on the contours. I know that this is not exactly what you were 
looking for. In order to get from your contours to 5m, 15m, etc areas 
you would have to probably interpolate your data and then create new 
contours at those levels, but you alreay said that this is not an option 
because of the time involved. But maybe the 10m, 20m areas are already 
close enough to what you are looking for.

Another option would be to go the vector route. Brainstorming:

- transform your raster contours to vector lines (r.to.vect)
- transform those to boundaries (v.type)
- if necessary, add a line at the edge of the region and patch that with 
your contour lines to close polygons (v.in.region, v.patch)
- add centroids to create areas (v.centroids)
- for each boundary get the category values of areas on each side of the 
boundary (v.to.db)
- then, through query of the attribute table, get for each area, the 
average of the contour values surrounding that area

Moritz




More information about the grass-user mailing list