[Gdal-dev] WKB

Frank Warmerdam warmerdam at pobox.com
Mon Nov 21 12:03:01 EST 2005


On 11/21/05, Bart van den Eijnden <BEN at syncera-itsolutions.nl> wrote:
> Hi list,
>
> I am trying to connect OGR through ODBC to a WKB database. The WKB database was created using TatukGIS (www.tatukgis.com).
>
> I am getting the following error back from OGR:
>
> C:\Programs\FWTools0.9.9>ogrinfo ODBC:synfonie/synfonie at tatukgistest
> ERROR 1: No column definitions found for table 'bis_loc_FEA', layer not usable.
> INFO: Open of `ODBC:synfonie/synfonie at tatukgistest'
> using driver `ODBC' successful.
>
> This is the record in the GEOMETRY_COLUMNS table (in XML format):
>
> <main>
>   <DATA_RECORD>
>     <F_TABLE_NAME>bis_loc_FEA</F_TABLE_NAME>
>     <F_GEOMETRY_COLUMN>GID</F_GEOMETRY_COLUMN>

Bart,

OGR's ODBC driver looks at F_TABLE_NAME and F_GEOMETRY_COLUMN.

However, GID isn't really the geometry column in BIS_LOC_FEA, instead
it is just the key into the other table to fetch the geometry.  OGR's ODBC
driver does not support this form of relationship.

> CREATE TABLE BIS_LOC_FEA
> (
>   GID        NUMBER(9)                          NOT NULL,
>   LOC_CODE   VARCHAR2(11 BYTE),
>   XCOORD     NUMBER(9),
>   YCOORD     NUMBER(9),
>   TAB_LABEL  VARCHAR2(5 BYTE)
> )
>
> What could be the problem? Thanks in advance. It seems TatukGIS does not write SRS info, but that does not seem to be the cause of the above error.

I have recently learned that the form that TatukGIS is
emitting things into the database is one of the approaches
defined in the OpenGIS Simple Features Specification.
However, OGR's ODBC driver just expects the geometry
column to the name of the geometry column right in the
feature table itself.

Another client has run into something similar, and on their
behalf I implemented support for WKB in ODBC (likely
not in FWTools 0.9.9 by the way, I suggest to upgrade to
1.0.0a8).  They then created a view that joined the feature
table and the geometry table and then referenced that view
explicitly.

Eg.

ogrinfo -ro ODBC:synfonie/synfonie at tatukgistest,BIS_LOC_VIEW(WKB_GEOMETRY)

The above syntax instructs OGR to use the "table" BIS_LOC_VIEW
which can actually be a view.  And it uses the column WKB_GEOMETRY
as the geometry, which after the join on GID should be the WKB blob
column.

By the way, if you don't really need the feature stuff you could skip
the view and get at the geometry like:

ogrinfo -ro ODBC:synfonie/synfonie at tatukgistest,BIS_LOC(WKB_GEOMETRY)

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    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list