[Gdal-dev] ogr2ogr MapINfo bug?

Frank Warmerdam warmerdam at pobox.com
Thu Nov 30 15:00:50 EST 2006


Bill Thoen wrote:
> Mateusz, Frank,
> 
> Thanks for looking into this. I don't really understand what the issue is,
> but even when I don't use the asterisk with the -sql switch, I still get an
> "unknown" geometry. My Postgres/PostGIS table does have an SRID associated
> with it and the geometry column is properly referenced in the
> geometry_columns table.

Bill,

As a work around you should be able to use the AsBinary() function on the
geometry field.  I have dug into this and discovered that the default
return format is Extended WKB (a postgis extension).  I have modified
the  GDAL code in CVS to support this, so now the -sql results work
much better.

> Also, there is still an additional problem with MapInfo output. For
> example, when I try the -where switch with the output being MapInfo Tab,
> the resulting table has no data in the *.id file (the map feature index). 
> 
> This produces a MapInfo table with a corrupt *.id file:
> ogr2ogr -f "MapInfo File" -where "fips='17055'" -a_srs WGS84 test.tab
>   "PG:dbname=spatial1" counties
> 
> But if I issue the same command with the output set to shape file, it
> works. The following command works perfectly:
> 
> ogr2ogr -f "ESRI Shapefile" -where "fips='17055'" -a_srs WGS84 test.shp
>   "PG:dbname=spatial1" counties

In my experience this indicates that no features matchedd the query.
Is it possible fips is a numeric field?  Or perhaps the field name is
actually FIPS?  I believe postgres will  be picky about stuff like this.
And I'm not certain you will get good error messages.

> What do you recommend I do at this point? Is there a workaround for MapInfo
> output?  Should I submit a bug report?  It sounds like you know more about
> what's happening here than I do, but I just wanted to know if I need to do
> anything else.

If you can verify that the -where isn't working, please provide a detailed
bug report.  If you would like an FWTools build with the geometry fix let
me know and I'll prepare one.  If you are building from source you should
be able to grab the nightly cvs snapshot.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list