[mapserver-users] JOIN SHP and CSV

Steve Lime Steve.Lime at dnr.state.mn.us
Thu Oct 1 12:08:19 PDT 2009


Hi Stefan: Well, the obvious problem is that you haven't set the join CONNECTIONTYPE. The docs
look to be wrong to me in a couple of ways wrt to CSV joins. The first is the connection type as
mentioned earlier. The second is that CSV join code doesn't use the first row as column names,
instead you refer to the columns by number (1, 2, 3, ..., n). It's a pretty basic implementation
I'll admit.

So, your JOIN block should look something like:

     JOIN
        NAME "tab"
        CONNECTIONTYPE CSV
        TABLE "../../../../daten/vektordaten/utm/studios/europa_sonnenstudio.csv"
        FROM "NAME"
        TO "1"
        TYPE ONE-TO-ONE
      END

and then in the template you'd use [tab_1], [tab_2], ... to access joined values.

Not sure why the docs are so far off, I'll file a ticket on that.

Steve

>>> Stefan Schantz <sschantz at bfs.de> 09/30/09 7:18 AM >>>
Hello,
although I 've read several informations (in this user list, mapserver 
documentation) about joining datas von a csv-file to a shp-file, I still 
get the error message "Content-type: application/vnd.ogc.se_xml 
msDBFJoinConnect(): Unable to access file. 
(../../../../daten/vektordaten/utm/studios/europa_sonnenstudio.csv)"
I 've tried already several things like putting csv-file at the same 
place as the mapfile, chmod 777 , but I always got the same message.
Any ideas? Thanks!

My mapfile looks like:
  LAYER
      NAME "europa"
      TYPE POLYGON
      STATUS ON
      DUMP TRUE
      DATA "europa"
 
      JOIN
        NAME "tab"
        TABLE 
"../../../../daten/vektordaten/utm/studios/europa_sonnenstudio.csv"
        FROM "NAME"
        TO "NAME"
        TYPE ONE-TO-ONE
      END
     
      PROJECTION
           "init=epsg:4326"
      END
      METADATA
            WMS_SRS "EPSG:25832 EPSG:4326 EPSG:32632 EPSG:31466 
EPSG:31467 EPSG:31468"
            WMS_TITLE "Sonnenstudio"
            WMS_ABSTRACT "blabla"
      END
      LABELITEM 'NAME'
     
      CLASS
     ...
      END  # CLASS
     
      CLASS
      ..
      END  # CLASS

      TEMPLATE "../templates/getFeature_sonnenstudio.html"
..

The path to the data is 
"/daten/vektordaten/utm/studios/europa_sonnenstudio.csv"
   303140 -rwxrwxrwx   1 ssh-m    gdi         2229 Sep 30 11:27 
europa_sonnenstudio.csv
path to the mapfile is "/data/umn/abc/map/studio.map"

The information of the csv-data is:
ogrinfo europa_sonnenstudio.csv europa_sonnenstudio -summary
INFO: Open of `europa_sonnenstudio.csv'
      using driver `CSV' successful.

Layer name: europa_sonnenstudio
Geometry: None
Feature Count: 54
Layer SRS WKT:
(unknown)
ID: String (0.0)
NAME: String (0.0)
TEXT: String (0.0)
DATUM: String (0.0)

The information of the shp-data is:
ogrinfo europa.shp europa -summary
INFO: Open of `europa.shp'
      using driver `ESRI Shapefile' successful.

Layer name: europa
Geometry: Polygon
Feature Count: 54
Extent: (-31.265747, 32.397476) - (69.070320, 81.857368)
Layer SRS WKT:
(unknown)
NAME: String (40.0)

Greetings from the Bavarian-Oktoberfest 

Stefan


_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the MapServer-users mailing list