[mapserver-users] javascript query template examples

Wendell Turner wendell at enflight.com
Thu Jun 25 14:59:16 PDT 2009


On Thu, Jun 25, 2009 at 03:13:21PM -0500, Steve Lime wrote:

> Here's one example using new-style templating (recommend
> MapServer 5.4.1). 

I'm using 5.2.0.  Do I need to upgrade?

> Anyway, please ask questions if you need to.

Ok!

> The TEMPLATE:
> 
> // MapServer Template
> function updateCountyList(element) {
>   var option;
...
> }

So, where does this template go?

1) there is a TEMPLATE in the WEB section.  It seems that if
that line is present, it gets used.  I don't think it is
that template.

2) There is DRIVER 'TEMPLATE' in the OUTPUTFORMAT section.
Should the above code be in a file named TEMPLATE?

3) There is a file in the FORMATOPTION under a /templates/
directory that looks suspicious.

4) There is a TEMPLATE in the LAYER section that is used to
indicate that the layer is queryable, and how to format that
layer's data.

> The OUTPUTFORMAT:
> 
> OUTPUTFORMAT
>     NAME 'county_select_list'
>     DRIVER 'TEMPLATE'
>     MIMETYPE 'text/javascript'
>     FORMATOPTION 'ATTACHMENT=county_select_list.js'
>     FORMATOPTION 'FILE=/templates/demo_county_select_list.js'
> END

What is the difference in ATTACHMENT and FILE?

> The call to the CGI to run it is:
> 
> <script src="http://maps.dnr.state.mn.us/cgi-bin/mapserv54?map=demo.map&qlayer=counties&qformat=county_select_list&mode=nquery"></script>

Aha! qformat=name_of_the_output_format

Thanks,

Wendell




More information about the MapServer-users mailing list