[FWTools] Mapinfo > Postgres > Mapinfo conversion problems

tim mortimer timortimer at googlemail.com
Sat Feb 20 07:50:40 EST 2010


Frank,
Thanks for you prompt response.

On 19 February 2010 17:49, Frank Warmerdam <warmerdam at pobox.com> wrote:

> 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.
>
>
I agree, but I have to work with what I get from the folks that supply the
tables [?] The -launder option doesn't change this behaviour but I can use
the -nln option on import and export to get around the issues.


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


Works great! thanks for directing me to these help pages which I hadn't
found.

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

I've resolved this by using the -select option with the output columns
listed in the order I want. Makes for a looong command but workable using a
batch file to execute it.


>
> 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<http://pobox.com/%7Ewarmerdam>
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20100220/a095e97a/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 97 bytes
Desc: not available
Url : http://lists.maptools.org/pipermail/fwtools/attachments/20100220/a095e97a/attachment.gif 


More information about the FWTools mailing list