[mapserver-users] On-the-fly field calculation in a GetFeatureInfo request
Robert Sanson
Robert.Sanson at asurequality.com
Thu Mar 16 18:58:41 PDT 2017
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.
Cheers,
Robert
From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Patrice
Sent: Friday, 17 March 2017 6:59 a.m.
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] On-the-fly field calculation in a GetFeatureInfo request
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.
On 2017-03-16 03:50, Jörg Thomsen (WhereGroup) wrote:
Hello Patrice,
I would prefer to save the data in a database using a view to create the
additional field (I haven't tried, but I think even spatialite is
possible as mapserver-deatasource?)
Another way would be to use scripting
- calculate the value with javascript within the template-html or
- use server-side processing within the template
Regards, Jörg
Am 16.03.2017 um 03:25 schrieb Abrabacabra:
Hello,
Is it possible to do numeric calculations with the result of a
GetFeatureInfo? Some layers have an area field in square meters but I
want to display it to the user in acres or hectares. It would be nice
not having to create a second attribute column in my source layer just
for that.
I am using an html template at layer level to output the results of the
query.
Mapserver 7.0.4
Thank you,
Patrice
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Viele Grüße,
Jörg Thomsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20170317/f8b47708/attachment.htm>
More information about the MapServer-users
mailing list