Opened 13 years ago

Closed 11 years ago

#2209 closed defect (fixed)

ogr2ogr feature copying --> fields with dashes ("-")

Reported by: stalbot Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:


I used this command to convert a coverage to a postgis database:

*/ogr2ogr -f "PostgreSQL" -lco precision=no PG:"host=mercator user=postgres dbname=tembec5" phase4b/*

There were no error messages, but any field that contained a dash ("-")in the field name had no values in the postgres db.. It wasnt a big deal, I just renamed the fields in Arc, and it worked fine. I only wondered if anyone else had run into this, and if there might be a fix for it.

On the postgis-user discussion, I got the following response:

I believe the problem is that when the OGR PostGIS driver creates a field it "launders" problematic names such as those containing a dash into a form that uses an underscore instead.

But ogr2ogr's "feature copying" logic operates on the basis of field names and it skips the fields with dashes because it can't find the corresponding field in postgres.

Really, I think we need smarter logic in ogr2ogr for feature copying.

I'd appreciate it if you could file a ticket against GDAL/OGR on this issue (copy in my reply if you would).

In the meantime, pre-laundering the field names as you have done is the easiest work around.

Best regards,

Frank Warmerdam

Change History (1)

comment:1 Changed 11 years ago by Even Rouault

Resolution: fixed
Status: newclosed

This is a duplicate of #3247, which is fixed in GDAL/OGR 1.7.0

Note: See TracTickets for help on using tickets.