[GRASS5] Re: [bug #2034] (grass) v.in.shape: ERROR: Polygon controller contained error.

Radim Blazek blazek at itc.it
Fri Jul 25 11:15:19 EDT 2003


On Friday 25 July 2003 11:42, Radim Blazek wrote:
> > In my case, v.in.ogr accepts the file, but the result is not very good,
> > with many areas being attributed the wrong attribute and some receiveing
> > no attribute at all. The file is pretty complicated since there are a lot
> > of tiny islands in large areas and the centroids of these islands are
> > sometimes attributed to the large area.
>
> After v.clean, I expect? Are you sure that the input shapefile is correct?
> Especially if areas containing islands realy have holes inside?
> To check this, use v.format and then d.vect cats= to display one area only,
> you should see also islands of that area. You can also check this in
> ArcExplorer. If you don't see any islands, area is one polygon without
> holes
> and islands you see if you display everything, are just other areas above,
> that would mean incorrect shapefile which is impossible to import correctly
> to GRASS (areas may not overlap).
>
> Problem may be also in GRASS, either v.clean fails (I know that it is
> possible) but then centroids should be correctly placed, and only
> attachement to areas is wrong (try to query centroids instead of areas),
> or Vect_get_point_in_poly_isl() in v.in.ogr fails, but
> Vect_get_point_in_poly_isl() is inherited from 5.0 and I have had never
> problems with centroid placement.

I think that we have found the problems with Moritz, 
1) If OGR layer is not clean (generated from AI coverage for example)
   'bpol' tool is not enough and 'break' must also be used:
   v.clean tool=bpol,break,rmdupl
2) In vector imported by v.in.ogr are missing centroids for 2.,3. etc. polygons
   of one feature. I cannot find a bug in v.in.ogr. It seems to me that 
   'Polygon' in shapefile is converted to _one_ SFS 'Polygon' even if it contains
   more outer rings. That is not correct according to SFS where Polygon is defined:
   "A Polygon is a planar surface, defined by 1 exterior boundary and 0 or more 
    interior boundaries. Each interior boundary defines a hole in the polygon."
   But I cannot believe that OGR does not work correctly for shapefile. 
   Frank, what am i missing?

Radim

PS: To go around, use shapefile linked by v.format as imput for v.clean.




More information about the grass-dev mailing list