WG: OGR, ODBC join on OGR, ODBC

Frank Warmerdam warmerdam at POBOX.COM
Mon May 14 13:48:40 PDT 2007


Arnd Wippermann wrote:
> Hello,
> 
> I have an Access DB to hold the geometry as WKT-String and attributes of a
> line layer and use OGR with ODBC to display my features.
> 
> GEOLINES           the line geometry as WKT-String
> GEOLINES_TREPPE    the attributes for the lines
> GEOMETRY_COLUMNS   the configuration of table, objecttyp and srs
> 
> I have no problem with 
> 
> CONNECTIONTYPE OGR
> CONNECTION 'ODBC:GEOOBJEKT,GEOLINES'
> 
> to display my lines on the map.
> 
> But I want to classify my lines with values from the table GEOLINES_TREPPE.
> 
> In Access the following query delivers what I expect:
> SELECT * FROM GEOLINES LEFT JOIN GEOLINES_TREPPE ON GEOLINES.ID_GEOOBJEKT =
> GEOLINES_TREPPE.ID_GEOOBJEKT;
> 
> When I use this query for my GEOLINES layer in a mapfile and add the
> DATA-line, nothing will display and also no error message is given.

Arnd,

I believe the problems is that the ODBC driver does not know what column
in your select result to use as the geometry since it finds this in
the GEOMETRY_COLUMNS table.  But this mechanism only works for simple
tables, not custom selects.

One option might be to use a VRT wrapper for the ODBC datasource to
accomplish this instead of trying to use GEOMETRY_COLUMNS.

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 MapServer-users mailing list