[GRASS5] Re: [5.7] remove islands and U-dangles?

Otto Dassau otto.dassau at gmx.de
Tue May 11 11:10:05 EDT 2004


On Tue, 11 May 2004 20:59:25 +1200
Hamish <hamish_nospam at yahoo.com> wrote:

> On Thu, 12 Feb 2004 10:06:09 +0100
> Radim Blazek <blazek at itc.it> wrote:
> 
> > On Thursday 12 February 2004 06:42, you wrote:
> > > > > any chance I could try the buggy version of extract.c? I think
> > > > > '-d' will do exactly what I need, and I don't care about
> > > > > centroids.
> > > >
> > > > Go to v.extract/main.c and enable d_flag (commented),
> > > > then in v.extract/extract.c in block starting at the row 69 add
> > > > something which checks if area on both sides are exracted.
> > >
> > > I'll try, but I'm not too sure how to do "check if area on both
> > > sides are exracted" yet..
> > 
> > You have to check if both catr and catl are in num_array[] (number of
> > items num_index) so you need a loop as num_array is not sorted. It is
> > awful v.extract should be rewritten a bit I think, maybe
> > Vect_str_to_cat_list(), Vect_array_to_cat_list(),
> > Vect_cat_in_cat_list().
> 
> see also http://article.gmane.org/gmane.comp.gis.grass.user/3870
> 
> 
> The following patch makes the -d (dissolve) function of v.extract work.
> (this is against today's CVS)
> 
> It works, but probably needs some cleanup before putting in CVS..
> (i.e. I've taken it as far as I can, someone else please do it)
> 
> It's faster than I thought it would be.. (for 15,000 cats)
> 
> Usage:  v.extract -d in=vect1 out=vect2 type=area,boundary list=1-50000
> 
> 
> Also, 'v.extract type=area list=1,2,3' keeps areas with missing
> centroids; how do you automatically add missing centroids so you can
> then get rid of the zombie areas with another 'v.extract list=1,2,3'?
> 
> These are islands within a bigger area, in the following I want to get
> rid of "A2". The outer boundary is made up of multiple lines. A1 has a 
> centroid.
> 
> +------------+
> |            |
> |   +--+     |
> |   |A2|     |
> |   +--+  +  |
> |         A1 |
> +------------+

Thank you very much for working on this problem just a few days after I sent my 'Wish' to the bugtracker!
I have tested the module patch with part of the spearfish location and made some screeshots. Maybe I can help to make it clearer.

1) http://www.gdf-hannover.de/dassau/muell/d.vect.png

Visualize spearfish soils data:
d.vect soils where='cat<20'

2) http://www.gdf-hannover.de/dassau/muell/v.extract.png

Using v.extract without dissolve option
v.extract in=soils out=soils2 type=area,centroid where='cat<20'

-> extracted areas within areas don't have an centroid anymore but are still visualized, although they should be deleted, as with d.vect. Topologically, this might be correct, because an area is surrounded by boundaries, but it should not be displayed, I think.

3) http://www.gdf-hannover.de/dassau/muell/v.extract_d.png

Using v.extract with dissolve option
v.extract -d in=soils out=soils3 type=area,centroid where='cat<20'

-> areas with cat<20 are dissolved (very nice), but now areas with dublicated centroids exist. And areas cat='21 and 43' still exist 
but without centroid, as in example 2. 

  Otto



 












More information about the grass-dev mailing list