MapServer TEMPLATE: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
Line 1: Line 1:
It helps me to understand a concept if I write about it. Here we go.
"Templates" is the simplest way to create an interactive mapserver site.
"Templates" is the simplest way to create an interactive mapserver site.
(You can create non-interactive ones without templates but what's the fun of that?)
(You can create non-interactive ones without templates but what's the fun of that?)


Without even using a template, I (the masterful Web GIS progreammer) can create a .map file and an HTML template and put the appropriate URL onto a Web page, for example,
==The non-interacttive example==
 
Without using a template, I (the masterful Web GIS progreammer) can create a .map file and put the appropriate URL onto a Web page, for example,


http://mapserver.wildsong.biz/cgi-bin/mapserv?map=../mapserver/html/hello.map&mode=map&layer=credits
http://mapserver.wildsong.biz/cgi-bin/mapserv?map=../mapserver/html/hello.map&mode=map&layer=credits
Line 11: Line 11:
and tells it to load up a map file, display the results by sending the image  
and tells it to load up a map file, display the results by sending the image  
back to your browser ("mode=map"), and to display what's in the layer called credits ("layer=credits").
back to your browser ("mode=map"), and to display what's in the layer called credits ("layer=credits").
==The first template==


To get it to use my template file, I can change mode to browse and add
To get it to use my template file, I can change mode to browse and add
Line 16: Line 18:


http://mapserver.wildsong.biz/cgi-bin/mapserv?map=../mapserver/html/hello.map&mode=browse&map_web_template=../mapserver/html/hello.template.html
http://mapserver.wildsong.biz/cgi-bin/mapserv?map=../mapserver/html/hello.map&mode=browse&map_web_template=../mapserver/html/hello.template.html
I have to specify a layer; that example just shows you a blue box;
http://mapserver.wildsong.biz/cgi-bin/mapserv?map=../mapserver/html/hello.map&mode=browse&map_web_template=../mapserver/html/hello.template.html&layer=credits
The template has lots of mapserver template tags in it, which are a word enclosed by square brackets. They look like wiki tags, come to think of it.

Revision as of 23:05, 3 August 2005

"Templates" is the simplest way to create an interactive mapserver site. (You can create non-interactive ones without templates but what's the fun of that?)

The non-interacttive example

Without using a template, I (the masterful Web GIS progreammer) can create a .map file and put the appropriate URL onto a Web page, for example,

http://mapserver.wildsong.biz/cgi-bin/mapserv?map=../mapserver/html/hello.map&mode=map&layer=credits

This invokes the CGI version of the mapserv executable that lives on my server and tells it to load up a map file, display the results by sending the image back to your browser ("mode=map"), and to display what's in the layer called credits ("layer=credits").

The first template

To get it to use my template file, I can change mode to browse and add a template specifier:

http://mapserver.wildsong.biz/cgi-bin/mapserv?map=../mapserver/html/hello.map&mode=browse&map_web_template=../mapserver/html/hello.template.html

I have to specify a layer; that example just shows you a blue box;

http://mapserver.wildsong.biz/cgi-bin/mapserv?map=../mapserver/html/hello.map&mode=browse&map_web_template=../mapserver/html/hello.template.html&layer=credits


The template has lots of mapserver template tags in it, which are a word enclosed by square brackets. They look like wiki tags, come to think of it.