[GRASSLIST:7194] Re: v.in.e00 error

Tom Russo russo at bogodyn.org
Thu Jun 16 14:45:39 EDT 2005

On Thu, Jun 16, 2005 at 05:54:20PM +0200, we recorded a bogon-computron collision of the <lami at faunalia.it> flavor, containing:
> Dear all,
> I'm trying to import an e00 areas file but I have this error message:
> GRASS 6.0.0 (Toscana):~ > v.in.e00 file=/home/Documenti/Geoeco/geoeco_13.e00 
> type=area vect=casentino -v
> E00 ASCII found and converted to Arc Coverage in current directory
> Importing...
> Over-riding projection check.
> Proceeding with import...
> Layer: LAB
> WARNING: Column name changed: 'GEOECO_13#' -> 'GEOECO_13_'
> WARNING: Column name changed: 'GEOECO_13-ID' -> 'GEOECO_13_ID'
> Layer: ARC
> WARNING: Column name changed: 'FNODE#' -> 'FNODE_'
> WARNING: Column name changed: 'TNODE#' -> 'TNODE_'
> WARNING: Column name changed: 'LPOLY#' -> 'LPOLY_'
> WARNING: Column name changed: 'RPOLY#' -> 'RPOLY_'
> WARNING: Column name changed: 'GEOECO_13#' -> 'GEOECO_13_'
> WARNING: Column name changed: 'GEOECO_13-ID' -> 'GEOECO_13_ID'
> DBMI-Postgres driver error:
> Cannot execute:
> create table casentino_2 (cat integer, UserId integer, FNODE_ integer, TNODE_ 
> integer, LPOLY_ integer, RPOLY_ integer, LENGTH double precision, GEOECO_13_ 
> integer, GEOECO_13_ID integer, FNODE_ double precision, TNODE_ double 
> precision, LPOLY_ double precision, RPOLY_ double precision, GEOECO_12_double 
> precision, GEOECO_121 double precision, ID double precision, FROMNODE double 
> precision, TONODE double precision, LEFTPOLYG double precision, RIGHTPOLY 
> double precision)
> ERROR:  column "fnode_" duplicated

here's the problem.  Arc/View coverages are allowed to have characters in the
field name that GRASS, which converts everything to SQL-compliant names, does
not allow.  When GRASS converted FNODE# to FNODE_ it didn't check that there
was already such a field, and tried to create a DBF record with two FNODE_
fields.  Boom, illegal.  This bites me from time to time, too, as many 
e00 files come with attribute names that are illegal for SQL (for example,
fields named "DATE" are illegal in GRASS, but they show up in coverages from
time to time).

You can force this issue a few ways.  Unfortunately, both involve doing things
by hand.

1) do what v.in.e00 does by hand:  
   a) convert the e00 to an arc/view coverage with avcimport
   b) import to a grass vector layer with v.in.ogr --- but use the 
      "cnames=" option to specify what attribute names to use for all the 
      columns.  Since "cnames=" requires that you give all the attribute names 
      up to the ones you want to change, I find this a tedious approach.  But 
      in your case you would use something like:
      thus renaming the second occurrances of the two offending attributes.

2) edit the e00 file and change the names there, then import it
   if your e00 file is not compressed, you can just edit it --- it's a straight
   ASCII file.  Just change the FNODE# and TNODE# names to FNODE2 and TNODE2,
   then v.in.e00 won't rename them badly.  If your e00 file *is* compressed,
   you need to uncompress it, just the way that v.in.e00 does: by running 
   e00conv to get a straight ASCII e00 file first.

Hope that helps.

Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 
 "The only thing you can do easily is be wrong, and that's hardly
  worth the effort." -- Norton Juster

More information about the grass-user mailing list