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

Harmisch Bowman via RT said:

just being curious: does "v.in.ogr" in GRASS 5.1 accept the file?

Markus

Yes, it does.

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.

Moritz

On Friday 25 July 2003 09:22, Moritz Lennert wrote:

Harmisch Bowman via RT said:
>> just being curious: does "v.in.ogr" in GRASS 5.1 accept the file?
>>
>> Markus
>
> Yes, it does.

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.

Could I get the shapefile or at least one or few areas causing those errors?

Radim

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.