[mapserver-users] One-to-many join

Berend Veldkamp b.veldkamp at zonnet.nl
Thu Jun 12 05:55:16 EDT 2008


Hi,

I'm trying to get a one-to-many join in a Postgis db working. One-to-one is
working fine, but when I use one-to-many and add a template to the join
object, no joined records are returned. In fact, the join template seems to
be ignored altogether.
Does anyone have a working example? The documentation is limited to
"One-to-many joins: The more complex variant. If the join type is multiple
(one-to-many) the template is replaced by the set of header, template file
and footer specified in the mapfile.", and I'm not exactly sure what this
means. Do I need to specify where the "many" template(s) are inserted into
the "main" template?

Here's the layer definition from my mapfile, and the templates:

LAYER
  NAME Provincies
  TYPE polygon
  CONNECTIONTYPE postgis
  CONNECTION "host=localhost dbname=gisdb user=user password=pass"

  DATA "the_geom from nl97"
  STATUS on

  CLASS
    COLOR 0 128 128
    OUTLINECOLOR 0 64 64
  END

  METADATA
    "wms_title" "Provincies"
    "wms_srs" "EPSG:28992"
  END

  JOIN
    NAME "test"
    CONNECTION "host=localhost dbname=gisdb user=user password=pass"
    CONNECTIONTYPE ogr
    TABLE "lookup"
    FROM "provnr"
    TO "provnr"
    TYPE one-to-many
    TEMPLATE join.html
  END

  HEADER header.html
  FOOTER footer.html
  TEMPLATE provincies.html

END


provincies.html:
<tr>
<td>Naam: [provincie]</td>
<td>Inwoners: [inwoners]</td>
<td>Inkomen: [inkomen]</td>
<td>Provcode: [provnr]</td>
</tr>

join.html:
<!-- Join starts here -->
<tr><td>Joined field: [joined]</td></tr>
 <!-- Join ends here -->
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080612/bf50e365/attachment.html


More information about the mapserver-users mailing list