[GRASS5] filtering vector areas

Otto Dassau otto.dassau at gmx.de
Sun Jun 20 11:38:09 EDT 2004

On Sat, 19 Jun 2004 10:43:37 -0700
Michael Barton <michael.barton at asu.edu> wrote:

> On Jun 19, 2004, at 3:01 AM, grass5-request at grass.itc.it wrote:
> > Dear list,
> >
> > Currently I try to classify aerial images (30cm resolution) in order 
> > to get a generalized vector landcover map. Since the SMAP results 
> > contain lots of small areas. I use r.neighbour (again and again) to 
> > filter those areas and then convert the results into vector format.
> >
> > unfortunately those map still contains about 60000 polygons and most 
> > of them are smaller than maybe 50sqm. How is it possible to delete 
> > those polygons with different category values? I don't need them on 
> > the map?
> >
> > I would like to dissolve them according to their area size and/or 
> > maybe their category value for example and put them to one of the 
> > larger neighbour areas. I tried already the -d parameter in the 
> > v.extract module established by Radim and Hamish (my last test was on 
> > 17.June from CVS) - thanks a lot for this help! - but this problem 
> > probably can't be solved with it.

Dear Michael and Radim,

> Your subject talks about vector areas and you mention polygons. 
> However, if you are using r.neighbors and SMAP, you are dealing with 
> raster files. Perhaps you initially worked with raster files and then 
> converted them to areas??

Yes. Sorry if this didn't become clear in the first section. I classify raster maps (aerail images) but the resulting landcover map finally has to be in vector format.

> Anyway, prior to conversion to vectors, you could run r.reclass.area > to set to null() all the values below a specified size. Then run 
> r.fill.nulls to fill these areas from surrounding values. 

r.fill.nulls does splines interpolation and it only works if 'null' areas are surrounded by pixels with the same category value.

> Or you can use the map calculator or r.nulls to set the nulls to a > specified value.
> After conversion to vector, you can use v.to.db to add an area field > to your vector attribute table and use this to filter all areas below > or above a set value.

I tried this already I think. If I understand correctly you mean adding a column 'area' to my attribute table with polygone size to filter? Something like:

echo "ALTER TABLE test ADD COLUMN area float4" | db.execute
v.to.db map=test option=area units=me col1=area

As a result I can filter in the sense of extracting areas of a certain size, but it doesn't work as a dissolve. Ok, then I can use the -d option by v.extract. But this option 'only' handles (dissolves) areas with the same attribute value.  

Then there is the implemented sides option for v.to.db by Radim. I tried this but I don't understand how to use this option because I don't know what this option is for - sorry :-(

 sides - categories of areas on the left and right side of the boundary,
'qfield' is used for area category. 

Radim, could you please give an example what this option os for? Maybe this is a solution but I don't see it.

thanks a lot for all your help so far


More information about the grass-dev mailing list