JOIN object usage in a mapfile {Scanned}

Siki Zoltan siki at AGT.BME.HU
Sun Jan 14 11:38:26 PST 2007


Hi Jeff,

You should refer to the column in the joined table in your template like
[joinname_columnname]

In your case it should be
[test_VAL]

Be carefull with the upper and lower case letters!

Zoltan

On Sun, 14 Jan 2007, Jeff McKenna wrote:

> Hello everyone,
> 
> For the first time I am trying to use the mapfile JOIN object, and I 
> can't seem to get it to work.  From the mapjoin.c file I can see that 
> DBF, CSV, PostgreSQL, and MySQL are supported.  I have personally tried 
> to view query results joined from DBF, CSV, and PostgreSQL tables 
> unsucessfully.  (my goal is to also update the sparse documentation for 
> this also on http://mapserver.gis.umn.edu/docs/reference/mapfile/join). 
>   Here is my DBF test case:
> 
> Test Environment
> ****************
> 
> mapserver 4.10.0
> windows
> 
> mapfile layer
> *************
> 
> LAYER
>    NAME prov_bound
>    TYPE POLYGON
>    STATUS DEFAULT
>    DATA prov
>    CLASS
>      NAME "Province"
>      STYLE
>        OUTLINECOLOR 120 120 120
>        COLOR 255 255 0
>      END
>    END
>    TEMPLATE "../htdocs/cgi-query-templates/prov.html"
>    HEADER "../htdocs/cgi-query-templates/prov-header.html"
>    FOOTER "../htdocs/cgi-query-templates/footer.html"
>    JOIN
>      NAME "test"
>      TABLE "../data/lookup.dbf"
>      FROM "ID"
>      TO "IDENT"
>      TYPE ONE-TO-ONE
>    END
> END # layer
> 
> ogrinfo
> *******
> 
>  >ogrinfo lookup.dbf lookup -summary
> INFO: Open of `lookup.dbf'
> using driver `ESRI Shapefile' successful.
> 
> Layer name: lookup
> Geometry: None
> Feature Count: 12
> Layer SRS WKT:
> (unknown)
> IDENT: Integer (2.0)
> VAL: Integer (2.0)
> 
>  >ogrinfo prov.shp prov -summary
> INFO: Open of `prov.shp'
> using driver `ESRI Shapefile' successful.
> 
> Layer name: prov
> Geometry: Polygon
> Feature Count: 12
> Extent: (-2340603.750000, -719746.062500) - (3009430.500000, 3836605.250000)
> Layer SRS WKT:
> (unknown)
> NAME: String (30.0)
> ID: Integer (2.0)
> 
> 
> Template
> ********
> 
> <tr bgcolor="#EFEFEF"><td align="left">[NAME]</td><td 
> align="left">[VAL]</td></tr>
> 
> Query Results
> *************
> 
> Layer: Provinces
> 
> NAME	VAL
> ====    ====
> Ontario	[VAL]	
> 
> Other Notes
> ***********
> 
> - the join seems to be happening, because if I specify false FROM/TO 
> values errors are thrown, yet I cannot get values to appear from the 
> [VAL] field
> - ID/IDENT are integer values from 1 to 12
> - the join works with desktop GIS packages
> 
> 
> Can someone see what I am doing wrong?
> 
> thanks.
> 
> jeff
> 
> 
> 



More information about the MapServer-users mailing list