<div class="gmail_quote">Frank,<br>Thanks for you prompt response.<br><br>On 19 February 2010 17:49, Frank Warmerdam <span dir="ltr"><<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">tim mortimer wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm experiencing a few conversion problems between MapInfo and Postgres using ogr2ogr on WIndows:<br>
<br>
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.<br>
<br>
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?<br>
</blockquote>
<br></div>
Tim,<br>
<br>
I think spaces or extra periods in the filenames is pretty bad karma<br>
and you would be best off just renaming them before working with them.<br>
That said, the laundering item below might make it work.<div class="im"><br></div></blockquote><div><br>I agree, but I have to work with what I get from the folks that supply the tables <img goomoji="343" style="margin: 0pt 0.2ex; vertical-align: middle;" src="cid:343@goomoji.gmail"> The -launder option doesn't change this behaviour but I can use the -nln option on import and export to get around the issues. <br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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?<br>
</blockquote>
<br></div>
If you review the creation options at:<br>
<br>
<a href="http://www.gdal.org/ogr/drv_pg.html" target="_blank">http://www.gdal.org/ogr/drv_pg.html</a><br>
<br>
I think you want to pass "-lco LAUNDER=NO" to your commandline.</blockquote><div><br>Works great! thanks for directing me to these help pages which I hadn't found. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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?<br>
</blockquote>
<br></div>
Hmm, I hadn't expected that though column ordering is not necessarily<br>
guaranteed. I *suspect* this is because column ordering is not necessarily<br>
preserved in postgres.<br></blockquote><div><br>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.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Best regards,<br><font color="#888888">
-- <br>
---------------------------------------+--------------------------------------<br>
I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/%7Ewarmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>
and watch the world go round - Rush | Geospatial Programmer for Rent<br>
<br>
</font></blockquote></div><br>