<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-NZ" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">If you run the WMS GetfeatureInfo request from Javascript using an XMLHttpRequest, and you can assign the response to a variable and
 then access the responseText property. You would parse it, get the field value you need and then do what ever maths you need and then put it into an alert or popup.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Robert<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"> mapserver-users [mailto:mapserver-users-bounces@lists.osgeo.org]
<b>On Behalf Of </b>Patrice<br>
<b>Sent:</b> Friday, 17 March 2017 6:59 a.m.<br>
<b>To:</b> mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> Re: [mapserver-users] On-the-fly field calculation in a GetFeatureInfo request<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="font-family:"Calibri",sans-serif">Could you point me in the right direction for the solutions you proposed? I like the idea of do calculations client-side with javascript, however, I didn't figure out how to fetch the value within a <script>
 tag in the template.</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 2017-03-16 03:50, Jörg Thomsen (WhereGroup) wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Hello Patrice,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I would prefer to save the data in a database using a view to create the<o:p></o:p></pre>
<pre>additional field (I haven't tried, but I think even spatialite is<o:p></o:p></pre>
<pre>possible as mapserver-deatasource?)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Another way would be to use scripting<o:p></o:p></pre>
<pre>- calculate the value with javascript within the template-html or<o:p></o:p></pre>
<pre>- use server-side processing within the template<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Regards, Jörg<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Am 16.03.2017 um 03:25 schrieb Abrabacabra:<o:p></o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Hello,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Is it possible to do numeric calculations with the result of a<o:p></o:p></pre>
<pre>GetFeatureInfo? Some layers have an area field in square meters but I<o:p></o:p></pre>
<pre>want to display it to the user in acres or hectares. It would be nice<o:p></o:p></pre>
<pre>not having to create a second attribute column in my source layer just<o:p></o:p></pre>
<pre>for that.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I am using an html template at layer level to output the results of the<o:p></o:p></pre>
<pre>query.<o:p></o:p></pre>
<pre>Mapserver 7.0.4<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Thank you,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Patrice<o:p></o:p></pre>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>mapserver-users mailing list<o:p></o:p></pre>
<pre><a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><o:p></o:p></pre>
<pre><a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><o:p></o:p></pre>
</blockquote>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Viele Grüße,<o:p></o:p></pre>
<pre>Jörg Thomsen<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>