Hello,

Thank you very much. I was in the good way in the MapFile, but not in the way 
to test it.
I was testing my template using info tool of QGIS, and it was always displaying 
the base GetFeatureInfo results.
I noticed in your execise that you were using OpenLayers and 
getGetFeatureInfoUrl, so I did a test with an hardcoded url in my browser, and 
in this way it displays well the template.
I don’t know if you use QGIS, but do you have any idea on how to get the 
template result with it ?

Regards,

JCB

De : Kobben, Barend (UT-ITC) <b.j.kob...@utwente.nl>
Envoyé : vendredi 17 juin 2022 11:51
À : Jean-Christophe Bastin <jcbas...@thelis.be>; mapserver-users@lists.osgeo.org
Objet : Re: [mapserver-users] Need help/sample on how to use templating please

This is an exercise for our students, in a different environment, but contain 
the needed steps - you migth have missed on of them...
https://gip.itc.utwente.nl/exercises/docs/OpenLayersWMS/adding_getfeatureinfo_capability


--
Barend Köbben


On 17/06/2022, 11:12, "Jean-Christophe Bastin" 
<jcbas...@thelis.be<mailto:jcbas...@thelis.be>> wrote:

Hello,

Thank you for the answer, but I already tried other extensions.
Even with « .html », the result is the same.
In fact, I can put anything in TEMPLATE, I always get the base results.

JCB

De : Kobben, Barend (UT-ITC) 
<b.j.kob...@utwente.nl<mailto:b.j.kob...@utwente.nl>>
Envoyé : vendredi 17 juin 2022 11:02
À : Jean-Christophe Bastin <jcbas...@thelis.be<mailto:jcbas...@thelis.be>>; 
mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>
Objet : Re: [mapserver-users] Need help/sample on how to use templating please

It might be as simple as naming the template template.html instead of 
template.tmpl....

--
Barend Köbben


On 17/06/2022, 10:50, "MapServer-users on behalf of Jean-Christophe Bastin" 
<mapserver-users-boun...@lists.osgeo.org<mailto:mapserver-users-boun...@lists.osgeo.org>
 on behalf of jcbas...@thelis.be<mailto:jcbas...@thelis.be>> wrote:

Hello community,

I try to find how to format click results of my MapFile.
I test my WMS on QGIS. By default, infotool result looks like this :

GetFeatureInfo results:
Layer 'my_layer'
  Feature 1234:
    field_1 = value_1
    field_2 = value_2
    field_3 = value_3
    …

The field names are base version coming from the data source.
I'm looking to change them in a more literal way, something like « My super 
field 1 has the great value 1 ».
I found that the way to reach this is templating.
I found the documentation :

  *   https://mapserver.org/mapfile/template.html#template
  *   https://mapserver.org/output/template_output.html?highlight=template
And I looked for examples but I can't make it work, I was wondering what I'm 
doing wrong.

Here is what I did :
I created a file "my_template.tmpl" containing just two lines :

<!-- MapServer Template -->
MY TEST

Then, in a working Mapfile, I added the TEMPLATE to my LAYER (the file 
"my_template.tmpl" is stored at the same level than my MapFile) :

MAP
     ...
     LAYER
          ...
          TEMPLATE "my_template.tmpl"
          ...
     END
END

If I understand well, when I click to get informations, I should see now "MY 
TEST" ?
But it continues to display the base informations like explained above.

I also tried with OUTPUTFORMAT, but it doesn't work better :

MAP
     OUTPUTFORMAT
          NAME "infotool_template"
          DRIVER "TEMPLATE"
          MIMETYPE "text/html"
          FORMATOPTION "FILE=my_template.tmpl"
     END
     ...
     LAYER
          ...
          TEMPLATE "infotool_template"
          ...
     END
END

I guess I do something wrong, but I can't find what.
Missing parameter ? Simple/double cotes issue ? Bad names/references ? Or 
something about the client (QGIS in my case) asking informations ?
Any help/advice will be very appreciated.
Hope to have some feedback.

Many thanks :-)

JCB
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to