[FWTools] Mapinfo > Postgres > Mapinfo conversion problems

Frank Warmerdam warmerdam at pobox.com
Fri Feb 19 12:49:06 EST 2010


tim mortimer wrote:
> I'm experiencing a few  conversion problems between MapInfo and Postgres 
> using ogr2ogr on WIndows:
> 
> The command *ogr2ogr -f "PostgreSQL" "PG:host=xxx user=yyy dbname=db 
> password=zzz" table_name.tab*  works basically OK but I experience a 
> number of translation problems.
> 
> Firstly, if the original windows file name has spaces or periods(.) 
> these seem to act as escape char's and result in a truncated table name 
> in Postgres. I've tried all the combination of "" and ' ' around the 
> file name without success. Is there a solution to this?

Tim,

I think spaces or extra periods in the filenames is pretty bad karma
and you would be best off just renaming them before working with them.
That said, the laundering item below might make it work.

> Secondly, the uppercase attribute column titles are all translated to 
> lower case e.g. "FlowersMay" is created as "flowersmay". Is there a way 
> of preserving the case?

If you review the creation options at:

   http://www.gdal.org/ogr/drv_pg.html

I think you want to pass "-lco LAUNDER=NO" to your commandline.

> Going the other way with *ogr2ogr -f "MapInfo File" new_table_name.map 
> "PG:host=xxx user=yyy dbname=db password=zzz" "table_name"* again 
> basically works OK but this time all the columns are created in the new 
> mapinfo table in a different order than in the Postgres table. Again, is 
> there something I've missed?

Hmm, I hadn't expected that though column ordering is not necessarily
guaranteed. I *suspect* this is because column ordering is not necessarily
preserved in postgres.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the FWTools mailing list