[Gdal-dev] Problem exporting to MapInfo TAB with ogr2ogr from postgreSQL

Bill Thoen bthoen at gisnet.com
Thu Sep 14 10:53:25 EDT 2006


I just installed gdal 1.3.2 (compiled from source using the default 
settings) so I could use ogr2ogr to convert data in PostgreSQL to 
MapInfo, but I'm getting some weird results. First, I tried:
ogr2ogr -f "MapInfo File" test.tab "PG:dbname=spatial1" -sql "select * 
from napp2"

I expected trouble with this because there are two geometries for each 
record; a point and a polygon. But I got a file where  all records 
mapped to the same point location and all fields were rendered as 
char(254). So if you have multiple geometries, how do you specify the 
one you want?

Next I tried a table with only one geometry. I typed:
ogr2ogr -f "MapInfo File" test.tab "PG:dbname=spatial2" -sql "select id, 
gridcode from adams_v1 where gridcode=72 limit 50"

This time I got 50 records with the id and gridcode set to the right 
types, but no polygons. I tried specifying the geometry:
ogr2ogr -f "MapInfo File" test.tab "PG:dbname=spatial2" -sql "select 
the_geom, id, gridcode from adams_v1 where gridcode=72 limit 50"

but the result was the same. So I looked for documentation and found 
only some *.dox files. So my question is, how do I read the 
documentation, and why doesn't the MapInfo conversion work?

 Thanks,
- Bill Thoen



More information about the Gdal-dev mailing list