OGR-join problem with DBF files

Rainer Spittel gosia.rainer at T-ONLINE.DE
Mon Mar 7 05:12:37 PST 2005


Hi there,

  I try to join a shapefile and a second dbf file, which is in the same
directory. The shapefile's name is 'badeseenbremen' and the external dbase
file 'bade.dbf'. Both files have an id field (GewaessNr) which can be used
to join on.
  When I add following part in my mapfile:

  LAYER
    [...]
    CONNECTIONTYPE OGR
    CONNECTION "ms_wasser/baden/badeseenbremen.shp"
    DATA "SELECT * FROM badeseenbremen LEFT JOIN ms_wasser/baden/bade ON
badeseenbremen.GewaessNr = bade.GewaessNr"
    [...]

  I receive following error message:

Warning: [MapServer Error]: msDrawMap(): Failed to draw layer named 'Baden'.
in D:\ms4w\apps\wasser_2.0\ms_digitalmap_inc.php on line 755

Warning: [MapServer Error]: msOGRFileOpen(): ExecuteSQL(SELECT * FROM
badeseenbremen LEFT JOIN ms_wasser/baden/bade ON badeseenbremen.GewaessNr =
bade.GewaessNr) failed. SQL: Corrupt JOIN clause, expecting ON keyword. in
D:\ms4w\apps\wasser_2.0\ms_digitalmap_inc.php on line 755

Fatal error: Call to a member function on a non-object in
D:\ms4w\apps\wasser_2.0\ms_digitalmap_inc.php on line 757

  I tried to test the join with the help of ogrinfo and receives following
error:

>ogrinfo.exe badeseenbremen.dbf -sql "SELECT * FROM
badeseenbremen LEFT JOIN bade.dbf ON badeseenbremen.GewaessNr = bade.GewaessNr"
INFO: Open of `badeseenbremen.dbf'
using driver `ESRI Shapefile' successful.
ERROR 1: SELECT from table bade.dbf failed, no such table/featureclass.

  I read the OGC-SQL part more then ones and even in the forum I found a lot
of information about joining datasources. But I do not know why my ogr-tool
does not find the dbf file.

  I need help... :-(

Thanks

Rainer



More information about the MapServer-users mailing list