WG: OGR, ODBC join on OGR, ODBC

Arnd Wippermann arndw at WTAL.DE
Mon May 14 15:52:36 EDT 2007


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.

With ogrinfo I get some output, but nothing with a clue to my problem.
ogrinfo" "ODBC:GEOOBJEKT"
ogrinfo" "ODBC:GEOOBJEKT" -sql "SELECT * FROM GEOLINES;"
ogrinfo" "ODBC:GEOOBJEKT" -sql "SELECT * FROM GEOLINES LEFT JOIN
GEOLINES_Treppe ON GEOLINES.ID_GEOOBJEKT = GEOLINES_Treppe.ID_GEOOBJEKT;"

I hope someone have an idea what to do. I want to use ODBC, because with a
little code I'm able to modify the tables from my map-interface.

#### Part of the mapfile ####

LAYER
  NAME 'LINES'
  GROUP 'LINES'
  TYPE LINE
  STATUS ON

  CONNECTIONTYPE OGR
  CONNECTION 'ODBC:GEOOBJEKT,GEOLINES'
  
  #without the DATA-line the layer will drawn
  DATA "SELECT * FROM GEOLINES LEFT JOIN GEOLINES_TREPPE ON
GEOLINES.ID_GEOOBJEKT = GEOLINES_TREPPE.ID_GEOOBJEKT;"

  DEBUG ON
#
  CLASSITEM 'KATEGORIE' #column only in GEOLINES
  CLASS
    NAME 'Treppen'
    EXPRESSION /TREPPE/ # with /./ is no difference
    STYLE
      COLOR 64 64 64
      WIDTH 5
    END
    STYLE
      COLOR 255 128 0
      WIDTH 3
    END
  END

  CLASS
    NAME 'SONST'
    STYLE
      COLOR 0 255 255
      WIDTH 2
    END
  END

  ...


Mit freundlichen Grüssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/



More information about the mapserver-users mailing list