[mapserver-users] html query templates

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Wed Mar 24 11:07:16 PDT 2010


You didn't say if you're doing this in old or new style templates, but regardless you'd need to do this in javascript. I can illustrate easiest with a new style template since it's all in one place but the idea applies to either:

<!-- MapServer Template -->
<script>
  var length=0;
[resultset layer="layer1"]
  [feature]
    length += [length];
  [/feature]
[/resultset]
  alert("total length=" + length);
</script>

So, for each feature in layer1 we add to the overall length variable and then output it at the end. Does this help?

Steve

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Eric Weisbender
Sent: Friday, March 19, 2010 3:38 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] html query templates

I am trying to calculate the sum of several numeric values returned in a query template.  Is there a cgi variable for this or a way to distinguish say the first [length] of a line segment returned as apposed to subsequent [length] values returned for the same poly line shape.

Eric


_______________________________________________
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