[Mapserver-users] Re: Supporting Queryable in MMS

Daniel Morissette morissette at dmsolutions.ca
Thu Jan 30 18:30:43 EST 2003


Doug Nebert wrote:
> 
> I have only one layer (plans) and it is a polygon shapefile. It has
> four attributes, title, origin, themekey, and url. I need the layer
> to be queryable through getCapabilities and for the response to be
> formatted as an HTML document as a <table> construct, one row per
> returned feature. I'd hope that since one of the attributes is a URL
> that this would be exposed as a hyperlink rather than as text. The
> interaction will be to click on the map and have all polygons that
> are 'skewered' returned as a result.
> 
> I gather I must add WMS_FEATURE_INFO_MIME_TYPE "text/html" to the WEB
> object. But what, beyond TEMPLATE 'dummy' do I put inside the LAYER
> description?
> 

If you want to support text/html GetFeatureInfo output then you need
valid MapServer query templates.  This is not specific to the WMS, it's
just the way the traditional mapserv CGI handles query results.  There
are examples of templates used for query results in the Itasca demo for
instance.

OK, so here is what you need in details:

1- Add metadata "wms_feature_info_mime_type" "text/html" in the WEB
object in your mapfile to tell the WMS interface to advertize text/html
as a GetFeatureInfo format.

2- Set TEMPLATE, HEADER and FOOTER parameters in your layer:
   LAYER
     NAME "plan"
     ...
     TEMPLATE "plan_query.html"
     HEADER "plan_query_header.html"
     FOOTER "plan_qquery_footer.html"
   END

3- Create the three template files and place them in the same directory
as your .map file:

--- plan_query_header.html ---
  <table border=1>
  <tr>
    <th>Title</th>
    <th>Origin</th>
    <th>Theme Key</th>
    <th>URL</th>
  </tr>
------

--- plan_query.html ---
  <tr>
    <th>[title]</th>
    <th>[origin]</th>
    <th>[themekey]</th>
    <th><a href="[url]">[url]></a></th>
  </tr>
------

--- plan_query_footer.html ---
  </table>
------

That should do the trick.

Daniel
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------



More information about the mapserver-users mailing list