[GRASS5] filtering vector areas

On Jun 19, 2004, at 3:01 AM, grass5-request@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.

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??

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. 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.

Michael

_____________________________
C. Michael Barton, Professor & Curator
School of Human Origins, Cultures, & Societies
Arizona State University
Tempe, AZ 85287-2402

WWW - http://www.public.asu.edu/~cmbarton
Phone: 480-965-6262
Fax: 480-965-7671

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

On Jun 19, 2004, at 3:01 AM, grass5-request@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 :frowning:

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

    Otto
  

On Sunday 20 June 2004 17:38, Otto Dassau wrote:

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 :frowning:

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.

You can identify the boundaries which have to be removed from the vector in SQL
if you have: area type, area size, boundary length, area on the left/right
side of the boundary. Whithout 'sides' option in v.to.db, it was impossible
to get area on the left/right side of the boundary.

Radim

On Sunday 20 June 2004 17:38, Otto Dassau wrote:
> 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 :frowning:
>
> 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.

You can identify the boundaries which have to be removed from the vector in
SQL if you have: area type, area size, boundary length, area on the
left/right side of the boundary. Whithout 'sides' option in v.to.db, it was
impossible to get area on the left/right side of the boundary.

I added also new tool=rmarea to v.clean, which removes small areas.
If you need to keep small areas of certain category, you can do
v.extract; v.clean tool=rmarea; v.patch; v.clean tool=rmdupl

Previous suggestion (v.to.db + SQL) is still valid however.

Radim