[mapserver-users] OGR data connection keeps failing

jack.morisson at mail.com jack.morisson at mail.com
Tue Oct 26 03:37:45 EDT 2010


Hi all,


I'm trying to color polygons based on a value in another dbf file.  The temp.dbf/shp contains my geometries, while the mine.dbf contains the same polygon_id field, as well as a field 'color'. However, the join itself is already failing.



Here's what i'm doing:


C:\DEVELOPMENT>shp2img -m train.map -o test.png -all_debug 5

OGR: OGROpen(C:\DEVELOPMENT/.\data/temp.dbf/033B5A88) succeeded as ESRI Shapefile.
OGR: OGROpen(data/mine.dbf/03DF3EC0) succeeded as ESRI Shapefile.
OGR: ReleaseDataSource(data/mine.dbf/03DF3EC0) dereferenced and now destroying.
msDrawMap(): Image handling error. Failed to draw layer named 'MyJoins'. <br>

msOGRFileOpen(): OGR error. ExecuteSQL(SELECT * FROM temp LEFT JOIN 'data/mine.dbf'.mine ON mine.POLYGON_ID = 'temp.POLYGON_ID' ) failed.
SQL: Unrecognised primary field mine.POLYGON_ID in JOIN clause.. <br>





Here's my OGR section in the mapfile:


CONNECTIONTYPE OGR
CONNECTION "data/temp.dbf"   
DATA "SELECT * FROM temp LEFT JOIN 'data/mine.dbf'.mine ON mine.POLYGON_ID = 'temp.POLYGON_ID' "



I tried all variants with quotes, and also switching the mine.polygonid with the temp.polygonid, but they keep failing.


I've seen examples on this mailing list and on the web, and as far as I can tell, this is all correct and should work. But perhaps I'm in need of glasses :o)




As for version information, I'm using the latest version of MS4W.


C:\ms4w>ogr2ogr --version
GDAL 1.7.1, released 2010/02/08



MapServer version 5.6.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICO
NV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUP
PORTS=THREADS SUPPORTS=GEOS SUPPORTS=RGBA_PNG SUPPORTS=TILECACHE INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE



If i load the shapefiles without the join, everything works ok. So it is safe to assume that the problem does not reside in my shapefiles or my mapfile.


dbfdump clearly shows the field POLYGON_ID in both dbf files.


Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20101026/802ac959/attachment-0001.html


More information about the mapserver-users mailing list