AW: [mapserver-users] OGR data connection keeps failing

Arnd Wippermann arnd.wippermann at web.de
Tue Oct 26 09:43:22 PDT 2010


Hi,
 
below two ways that work for me:
 
  CONNECTIONTYPE OGR
  CONNECTION "M:\BRD\DEU_adm1.shp"
  DATA "SELECT * FROM DEU_adm1 LEFT JOIN
'M:\BRD\DEU_adm1_EDICHTE.dbf'.DEU_adm1_EDICHTE ON DEU_adm1.HASC_1 =
DEU_adm1_EDICHTE.HASC_1"
 
  CONNECTIONTYPE OGR
  CONNECTION "M:\BRD"
  DATA "SELECT * FROM DEU_adm1 LEFT JOIN DEU_adm1_EDICHTE ON DEU_adm1.HASC_1
= DEU_adm1_EDICHTE.HASC_1"

...
  CLASS
    NAME 'ED < 250'
    EXPRESSION ([ED]>100 AND [ED]<250)
    STYLE
      COLOR 254 227 145
      OUTLINECOLOR 255 50 50
      WIDTH 1
    END
  END
...
 
The layer is colored by the attribute from the dbf/table "DEU_adm1_EDICHTE"
field "ED".
 
Arnd

________________________________

Von: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] Im Auftrag von
jack.morisson at mail.com
Gesendet: Dienstag, 26. Oktober 2010 09:38
An: mapserver-users at lists.osgeo.org
Betreff: [mapserver-users] OGR data connection keeps failing


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.




More information about the MapServer-users mailing list