[GRASSLIST:4976] Problem with shapefile

Michael Ash mash at econs.umass.edu
Sat Nov 16 08:59:28 EST 2002


With your permission, I am posting my response to
grasslist at baylor.edu which, I learned recently, is more
focused on _users'_ questions and discussion than is the
development-oriented grass5 at grass.itc.it.  (See
http://grass.itc.it/support.html#int_list for details on how
to join) I hope that you do not consider the shift of venue
rude.

I too have had difficulties importing shapefiles with
v.in.shape.  I have had more success importing the same set
of vectors from .e00 files, the ESRI export format with
m.in.e00.  Perhaps your shapefile source can also provide
.e00 versions.


Best regards,

Michael Ash


>    3. Problem with shapefile (Virgilio =?ISO-8859-1?Q?G=F3mez?= Rubio)
>    7. Re: Problem with shapefile (David D Gray)


> Message: 3
> From: Virgilio =?ISO-8859-1?Q?G=F3mez?= Rubio <Virgilio.Gomez at uv.es>
> To: grass5 at grass.itc.it
> Date: 15 Nov 2002 14:56:00 +0100
> Subject: [GRASS5] Problem with shapefile
> 
> Hi all,
> 
> It's been a long time since we met in Trento, isn't it?
> 
> I am writting because I have a problem when timporting a shapefile.
> What happens is that some lines (and ares) are lost. The command line
> and error message I get are:
> 
> 
> GRASS:~/tmp > v.support option=build -r map=cod_munici
> err=err_cod_munici
> 
> V.SUPPORT:
> 
> Selected information from vector header
>  Organization:
>  Map Name:      cod_munici
>  Source Date:
>  Orig. Scale:   2400
>  Snapping threshold    0.00
> Snapp No snapping will be done
>     Reading Vector file 100%
>     Building areas 100%
> Unclosed area, free end or edge inside area: line 771
> Unclosed area, free end or edge inside area: line 773
> Unclosed area, free end or edge inside area: line 777
> Unclosed area, free end or edge inside area: line 828
> Unclosed area, free end or edge inside area: line 829
> Unclosed area, free end or edge inside area: line 1774
> Unclosed area, free end or edge inside area: line 1776
>     Building islands 100%
>     Attaching labels
> PNT_TO_AREA failed: (765673.634168, 4491702.952495) (Category 12052)
> PNT_TO_AREA failed: (768903.289024, 4484561.074964) (Category 12100)
> PNT_TO_AREA failed: (718003.592441, 4386435.398790) (Category 46070)
> PNT_TO_AREA failed: (712646.684383, 4382275.341311) (Category 46116)
> WARNING: area 176 label: 46902 matched another label: 12066.
> PNT_TO_AREA failed: (714668.427559, 4382979.700161) (Category 46903)
> PNT_TO_AREA failed: (717899.462949, 4378108.989802) (Category 46190)
>  Number of lines:   1876
>  Number of nodes:   1244
>  Number of areas:   651
>  Number of isles:   28
>  Number of atts :   652
>  Number of unattached atts :   6
>  Snapped lines  :   0
> 
> 
> I think the problem is related to that unclosed areas, but it is also
> true that ArcVIew reads the shapefile without problems.
> 
> Any idea?
> 
> Of course, if some developer wants to try the shapefile I can send it to
> him/her.
> 
> Regards, thanks and best wishes,
> 
> -- 
>              Virgilio Gómez Rubio
> 
> Dpto. Estadística e I. O. - Facultat de Matemàtiques
> Avda. Vicent A. Estellés, 1 - 46100 Burjassot
> Valencia - SPAIN
> 
> http://matheron.uv.es/~virgil
> 
> TLF: 00 34 96 386 43 62 - FAX: 00 34 96 398 35 99
> 


> --__--__--
> 
> Message: 7
> Date: Sat, 16 Nov 2002 03:19:02 +0000
> From: David D Gray <ddgray at armadce.demon.co.uk>
> To: =?ISO-8859-1?Q?Virgilio_G=F3mez_Rubio?= <Virgilio.Gomez at uv.es>
> CC: grass5 developers list <grass5 at grass.itc.it>
> Subject: Re: [GRASS5] Problem with shapefile
> 
> Virgilio Gómez Rubio wrote:
> > Hi all,
> > 
> > [...]
> > 
> > GRASS:~/tmp > v.support option=build -r map=cod_munici
> > err=err_cod_munici
> > 
> > V.SUPPORT:
> > 
> > Selected information from vector header
> >  Organization:
> >  Map Name:      cod_munici
> >  Source Date:
> >  Orig. Scale:   2400
> >  Snapping threshold    0.00
> > Snapp No snapping will be done
> >     Reading Vector file 100%
> >     Building areas 100%
> > Unclosed area, free end or edge inside area: line 771
> > Unclosed area, free end or edge inside area: line 773
> > Unclosed area, free end or edge inside area: line 777
> > Unclosed area, free end or edge inside area: line 828
> > Unclosed area, free end or edge inside area: line 829
> > Unclosed area, free end or edge inside area: line 1774
> > Unclosed area, free end or edge inside area: line 1776
> >     Building islands 100%
> >     Attaching labels
> > PNT_TO_AREA failed: (765673.634168, 4491702.952495) (Category 12052)
> > PNT_TO_AREA failed: (768903.289024, 4484561.074964) (Category 12100)
> > PNT_TO_AREA failed: (718003.592441, 4386435.398790) (Category 46070)
> > PNT_TO_AREA failed: (712646.684383, 4382275.341311) (Category 46116)
> > WARNING: area 176 label: 46902 matched another label: 12066.
> > PNT_TO_AREA failed: (714668.427559, 4382979.700161) (Category 46903)
> > PNT_TO_AREA failed: (717899.462949, 4378108.989802) (Category 46190)
> >  Number of lines:   1876
> >  Number of nodes:   1244
> >  Number of areas:   651
> >  Number of isles:   28
> >  Number of atts :   652
> >  Number of unattached atts :   6
> >  Snapped lines  :   0
> > 
> 
> Hi,
> 
> The most likely reason is that the areas do not build because there are 
> 'topologically incorrect' features in the affected polygons - for 
> example, one polygon edge has a vertex where its neighbour has none, for 
> example, as follows:
> 
> -------------A----------------B-------------------------C-----
> -------------A------------------------------------------C-----
> 
> The stable release of the import process recognises the loop A-B-C-A as 
> a 'degenerate' polygon, but the build process detects it as an error, so 
> the the areas adjacent to the affected segment do not build.
> 
> > 
> > I think the problem is related to that unclosed areas, but it is also
> > true that ArcVIew reads the shapefile without problems.
> > 
> 
> It may appear that ArcView has no problems but its display does not 
> check to see if polygons are correctly matched with their neighbours. 
> This can affect various processing algorithms (ie ArcScripts) as well as 
> the attribute table. For example the degenerate polygons may or may not 
> be listed in the DBF file. (What you expect of course is that they 
> shoudn't be)
> 
> > Any idea?
> > 
> 
> The best procedure is to track down the problem polygons with v.digit 
> and eliminate the offending lines.
> 
> 0) Back up the attributes file in dig_att under the mapset. This is just 
> cd'ing to the dig_att directory and copying the file to something 
> convenient.
> 1) Use Tools | o to highlight the problem areas.
> 2) The option Tools|n will help to track down which of the polygons 
> edges are problems. v.rm.dangles might help also.
> 3) When you are confident a particular line is a duplicate or otherwise 
> problem edge, you can go back to the top level and use Edit|r to remove it.
> 4) When the bad edges have been fixed, go back to the dig_att directory, 
> resotore the atts file to the correct name and then rebuild.
> 
> > Of course, if some developer wants to try the shapefile I can send it to
> > him/her.
> > 
> 
> In a former version v.in.shape went to considerable lengths to try and 
> elliminate many errors automatically, but this ended up introducing far 
> more problems than it solved. The current version is at the other 
> extreme - it import maps as they are, and if there are problems they 
> must be fixed manually. A revision of the module is in progress that 
> will remove errors only of the kind described above. In usable maps 99% 
> of errors are caused this way anyway. If there are more serious errors, 
> the map is pretty corrupt anyway, and maybe then you should request the 
> source to provide a better set of files.
> 
> David
> 





More information about the grass-user mailing list