[Gdal-dev] WKB

Bart van den Eijnden BEN at Syncera-ITSolutions.NL
Tue Nov 22 02:16:54 EST 2005


Hi Frank,

thanks. Creating the view and upgrading to fwtools 1.0a8 works.

OGRFeature(V_BIS_LOC):123
  GID (Real) =       124
  LOC_CODE (String) = AA055500227
  XCOORD (Real) =     75417
  YCOORD (Real) =    441540
  TAB_LABEL (String) = (null)
  XMIN (Real) = 75220
  YMIN (Real) = 441177
  XMAX (Real) = 75491
  YMAX (Real) = 441739
  POLYGON ((75343.505499999999 441636.88299999997,75381.4035 441712.02549999999,
75434.329500000007 441739.46899999998,75440.864000000001 441683.27549999999,7547
4.1875 441540.17800000001,75491.176500000001 441340.234,75343.505499999999 44163
6.88299999997),(75275.550499999998 441480.06400000001,75368.988500000007 441299.
72249999997,75274.896999999997 441177.53450000001,75252.680999999997 441199.7505
0000002,75256.601500000004 441214.12550000002,75253.334499999997 441241.56849999
999,75241.573000000004 441265.09149999998,75231.118499999997 441282.08049999998,
75220.664000000004 441296.45549999998,75227.198000000004 441318.01799999998,7522
7.851500000004 441359.18300000002,75238.959499999997 441397.08100000001,75275.55
0499999998 441480.06400000001))

Best regards,
Bart

Bart van den Eijnden
Syncera IT Solutions
Postbus 270
2600 AG  DELFT

tel.nr.: 015-7512436
email: BEN at Syncera-ITSolutions.nl

>>> Frank Warmerdam <warmerdam at pobox.com> 11/21/2005 6:03 PM >>>
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