[mapserver-users] Possible to use JavaScript code in a MapServertemplate?
Bistrais, Bob
Bob.Bistrais at maine.gov
Mon Oct 31 10:41:51 PDT 2011
Great! Thank you Arnd!
Bob
________________________________
From: Arnd Wippermann [mailto:arnd.wippermann at web.de]
Sent: Monday, October 31, 2011 12:11 PM
To: Bistrais, Bob
Cc: mapserver-users at lists.osgeo.org
Subject: AW: [mapserver-users] Possible to use JavaScript code in a
MapServertemplate?
Hi,
MapServer 6 comes with "Built-in OpenLayers map viewer", template with
use of OpenLayers javascript library.
see http://mapserver.org/development/rfc/ms-rfc-63.html
an example, how I use javascript in templates:
<!-- Mapserver Template (Body Template) -->
<!-- styles are defined in Header Template -->
<script>
var idx = parseInt("[lrn]")%2;
var myClass = "tdBody" + idx;
if("[version]".search(/version 5.6.1/)!=-1)
var imgLeg =
"...?map=mapfile_561.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=getlegendgrap
hic&LAYER=[cl]&FORMAT=image/png&STYLES=";
else if("[version]".search(/version 6./)!=-1)
var imgLeg =
"...?map=mapfile_6.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=getlegendgraphi
c&LAYER=[cl]&FORMAT=image/png&STYLES=";
else
var imgLeg =
"...?map=mapfile_49.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=getlegendgraph
ic&LAYER=[cl]&FORMAT=image/png&STYLES=";
document.write("<tr class='tblBody'>");
document.write(" <td class='" + myClass + "'><img src='" + imgLeg +
"'></td>");
document.write(" <td class='" + myClass + "'>[NAME_LOCAL]</td>");
document.write(" <td class='" + myClass + "'>[NAME_FAO]</td>");
document.write(" <td class='" + myClass + "'>[UNREGION2]</td>");
document.write("</tr>");
</script>
Arnd
________________________________
Von: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] Im Auftrag von
Bistrais, Bob
Gesendet: Montag, 31. Oktober 2011 16:11
An: mapserver-users at lists.osgeo.org
Betreff: [mapserver-users] Possible to use JavaScript code in a
MapServertemplate?
Is it possible to write and execute JavaScript within a MapServer
template? What I'd like to do, when a ProcessTemplate is called for a
certain layer, I would like to check item values. If item values equal
a certain value, write something to the output. It would seem possible
since a template is an HTML file, but I'm just not sure how to do it, or
if it's possible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20111031/2510b2b4/attachment.htm>
More information about the MapServer-users
mailing list