[FWTools] Mapinfo > Postgres > Mapinfo conversion problems

Richard Greenwood richard.greenwood at gmail.com
Fri Feb 19 13:02:09 EST 2010


On Fri, Feb 19, 2010 at 10:02 AM, tim mortimer
<timortimer at googlemail.com> 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?

You can define the new table name that is created with -nln
"MyNewTable". Postgres tables can not have spaces, and if you want to
avoid having to quote table names, you should make them all lower
case.

> 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?

I don't know a work around, but personally I find this to be a feature
because postgres roll everything to lowercase. If your table has a
column "FlowersMay" you can not do a:
   SELECT FlowersMay from mytable;
because postgres would see that as:
   SELECT flowersmay from mytable;
it would have to be:
   SELECT "FlowersMay" from mytable;
so that postgres would honor the mixed case.

Rich
-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com


More information about the FWTools mailing list