Mapunits in template

Berend Veldkamp berend.veldkamp at ARIS.NL
Fri Sep 9 02:59:30 EDT 2005


Yes, that is probably the closest I can get.
I've made an enhancement request here: 
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1465

Berend


Steven Monai wrote:

> Berend:
> 
> To paraphrase your question: You want to be able to express the mapfile's
> UNITS parameter in the body of the HTML page emitted by the CGI, so you can
> pick up its value with client-side Javascript. You have probably found that
> there is no [units] tag, or any variation thereof, that you can use in your
> templates for this purpose. But here's a (less than optimal) workaround:
> Put your units in the METADATA section of the mapfile's WEB block, e.g.
> 
> WEB
>   ...
>   METADATA
>     ...
>     "units"  "meters"
>   END # of METADATA
> END # of WEB
> 
> Of course, now you have UNITS mentioned twice in your mapfile, with all the
> perils and pitfalls that can bring. But it is a workaround, because you can
> now refer to the METADATA "units" parameter in your template file as
> [web_units], e.g.:
> 
> <form name="mapform" method="POST" action="/cgi-bin/mapserv">
>   ...
>   <input type="hidden" name="units" value="[web_units]" />
>   ...
> </form>
> 
> With the above definitions, your Javascript can get the "units" string with
> a simple expression, e.g:
> 
> var map_units = document.mapform.units.value;
> 
> Hope this helps,
> -SM
> --
> 
> 


-- 
____________________________

Berend Veldkamp - ARIS
http://www.aris.nl/
____________________________



More information about the mapserver-users mailing list