lines and areas

David D Gray ddgray at armadce.demon.co.uk
Thu Oct 19 14:49:32 EDT 2000


> Stefan.Neumann at agrar.uni-giessen.de wrote:
> 
> Hi Grass,
> 
> is there a way to convert lines to areas ? I create lots of
> contour-lines with r.contour and I would like to make statistics
> (r.report type=area) on the areas surrounded by the contour-lines.
> This doesn't work though, because r.contour only creates lines, not
> areas.

Hi Stefan,

First make sure that the regions you want to assign to areas are closed.
You may have to clip the map with a grid. If you need that you can use
v.mkgrid, or create a suitable boundary with v.digit. Then v.cutter can
be used to create the clipped map.

There's a script called v.line2area which will alter the dig_att file to
have areas instead of lines, but area attributes are different from line
attributes and there is no immediately obvious way of assigning the area
range from the bounding contour values, apart from manually.

If you're starting from a raster map (I assume so since you used
r.contour), a better way might be to reclass the raster to the range you
want to use, with r.reclass, and then index the elevation levels and
labels if required. You might also want to apply a gentle consolidation
process with eg. r.neighbors set to method=mode. This may elliminate
small single cell anomalies and `rosaries', but might distort the data
too much. It's a question of resolution. A correctly labelled area
vector map will then be created with r.poly. This produces ragged edged
maps, but should produce accurate areas, and the area edges should be in
the same place as contour lines if you use the same elevation
categories.

> 
> Also I would like to create a map where the areas are filled with a
> color according to their attribute (with v.to.rast). This also only
> seems to work with areas.
> 

True, but in a line or linear features map, the areas do not correspond
to any clearly defined spatial entity, therefore they cannot be
labelled, rendered or otherwise processed.


Regards,  David




More information about the grass-user mailing list