[mapserver-users] GetFeatureInfo layout in plain text

Schepers, Benjamin schepers at rvr-online.de
Thu Nov 10 22:50:42 PST 2016


Hi @all,

thank you for that inspiration, Steve! This shows how valuable this list is...
And sorry, Yves, for giving a wrong hint; but HTML-GFI within ArcGIS 10.2+ works, but be careful with embedded javascript and advanced css in html-template, ArcGIS doesn't like that much.

Some thoughts on the Template-thing from Steve/Daniel:
Regarding to Daniels reference to wms-server-documentation (http://mapserver.org/ogc/wms_server.html#how-does-a-wms-work), GFI-section:
"text/html output using MapServer query templates (see Templating) specified in the CLASS TEMPLATE parameter (the filename has to have an .html extension). The MIME type returned by the Class templates defaults to text/html and can be controlled using the metadata “wms_feature_info_mime_type”.

It looks like there's a "natural" binding between template and html output. As Daniel stated, this can be overridden with setting a other " wms_feature_info_mime_type" - OK so far.
For example someone would now be using the template for individual text-plain output-styling and setting " 'wms_feature_info_mime_type' 'text/plain' ", what happens then, if a user requests the FeatureInfo in text/html, which is from my point of view the typical format? Mapserver wouldn't produce a valid html response anymore (because of the lack of an valid html-template), would it?
Should GFI with HTML then be forbidden or are multiple templates for different outputformats possible? How would this work?

Maybe I didn't fully understand Steve's hint and one of you can explain?

Thanks a lot,

Ben

-----Ursprüngliche Nachricht-----
Von: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] Im Auftrag von Lime, Steve D (MNIT)
Gesendet: Donnerstag, 10. November 2016 19:51
An: Yves Jacolin; mapserver-users at lists.osgeo.org
Betreff: Re: [mapserver-users] GetFeatureInfo layout in plain text

This should be possible. Templates are not limited to HTML output, any text based format should be able to be created. You do this through output formats. Here's an example for plain text:

 OUTPUTFORMAT
    NAME 'plain-text'
    DRIVER 'TEMPLATE'
    MIMETYPE 'text/plain'
    FORMATOPTION "FILE=templates/plain.tmpl"
    FORMATOPTION 'ATTACHMENT=myfile.txt'
  END

The template file's extension is really irrelevant to what's being delivered back to the client - the mimetype sets that. I don't recall of the top of my head how you expose this type via WMS but I think that's pretty straight forward.

Steve

-----Original Message-----
From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Yves Jacolin
Sent: Thursday, November 10, 2016 4:16 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] GetFeatureInfo layout in plain text

Hello,

I have to setup a text format for a WMS' GetFeatureInfo service. I would like to know if it is possible to change the layout using a template.

My first test was not working so any feedback is welcome. The documentation said that the user should read the templating chapter so I guess this is possible.

Any confirmation?

Y.
--
Responsable Formation et Support
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel (France) : +33 4 58 48 20 43 (new !) Tel (Suisse) : +41 21 619 10 43 Mob. : +33 6 18 75 42 21 Fax : 04 79 70 15 81 Mail : yves.jacolin at camptocamp.com http://www.camptocamp.com _______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
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