[mapserver-commits] r8692 - trunk/docs/tutorial
svn at osgeo.org
svn at osgeo.org
Mon Mar 9 09:58:35 EDT 2009
Author: pnaciona
Date: 2009-03-09 09:58:35 -0400 (Mon, 09 Mar 2009)
New Revision: 8692
Added:
trunk/docs/tutorial/section2.html
Log:
Add tutorial section 2
Added: trunk/docs/tutorial/section2.html
===================================================================
--- trunk/docs/tutorial/section2.html (rev 0)
+++ trunk/docs/tutorial/section2.html 2009-03-09 13:58:35 UTC (rev 8692)
@@ -0,0 +1,121 @@
+<html>
+ <head>
+ <title>MapServer 5.x Tutorial</title>
+ <link type="text/css" rel="stylesheet" href="ms35.css" />
+ </head>
+ <body bgcolor="#ffffff">
+ <table align="center" width="600" border="0">
+ <tr>
+ <td>
+ <h1 align="center">MapServer 5.x Tutorial</h1>
+ <h3 align="center">
+ Section 2: CGI variables and the User Interface
+ </h3>
+ <p>So far we have only looked at the mapfile when creating maps. In
+ creating web mapping applications, it is usually our intention to
+ make maps that can be changed by the user (of the application)
+ interactively. That is, a user should be able to change the content
+ of (or the information in) the map. To accomplish this interactivity,
+ we use the MapServer HTML templates.
+ </p>
+ <p>A MapServer HTML template is essentially an HTML file with a few
+ MapServer specific tags--these tags are the MapServer CGI variables
+ band are enclosed in square brackets "[]". When the MapServer CGI
+ program processes an application, it first parses the query_string
+ and the mapfile and produces the necessary output. Some of this
+ output will need to be written to the HTML template file which you
+ would have to also specify in the mapfile using the web template
+ keyword (or in a separate HTML initialization file). The CGI program
+ will replace all the variables in the HTML template with the proper
+ value before sending it back to the web browser. If you are to
+ directly view an HTML template on a web browser, there won't be any
+ maps rendered and you will instead get blank images and other junk.
+ </p>
+ <p>MapServer provides several variables for web mapping--the "img"
+ variable which you've seen in Example 1.9 is but one example. There
+ area few core CGI variables originally designed as part of the
+ mapping interface but practically all the mapfile parameters can be
+ defined as variables. The definitive reference to the CGI variables
+ can be found at
+ <a href="http://mapserver.gis.umn.edu/doc/cgi-reference.html">
+ http://mapserver.gis.umn.edu/doc/cgi-reference.html</a>.
+ </p>
+ <p>We can also define our own variable--MapServer will pass it
+ along to our application. For example, we can create a variable
+ called "root" to represent the root directory of this tutorial--the
+ value for "root" will then be "/tutorial". When the MapServer CGI
+ program processes our HTML template, it will replace every instance
+ of he "[root]" tag with "/tutorial". You will see this in action for
+ each of the following examples.
+ </p>
+ <p>So, let's build an interactive interface for our application...</p>
+ <p>Users of a web mapping application should be able to pan and zoom on
+ the map...<br>
+ <a
+ href="/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example2.map&layer=states&zoom=0&mode=browse&root=/tutorial&program=/cgi-bin/mapserv.exe&map_web=template+example2-1.html">Example 2.1 - Pan and Zoom Controls</a>
+ </p>
+ <p>... they also should be able to turn on and off layers on a map.<br>
+ <a
+ href="/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example2.map&layer=states&zoom=0&mode=browse&root=/tutorial&program=/cgi-bin/mapserv.exe&map_web=template+example2-2.html">
+ Example 2.2 - Layer Control
+ </a>
+ </p>
+ <p>A map should always include a scalebar.<br>
+ <a
+ href="/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example2.map&layer=states&zoom=0&mode=browse&root=/tutorial&program=/cgi-bin/mapserv.exe&map_web=template+example2-3.html">
+ Example 2.3 - Adding a Scalebar</a><br>
+ </p>
+ <p>If users are to navigate through the map, a reference map should be
+ provided.<br>
+ <a
+ href="/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example2.map&layer=states&zoom=0&mode=browse&root=/tutorial&program=/cgi-bin/mapserv.exe&map_web=template+example2-4.html"> Example 2.4 - Adding a Reference Map</a><br>
+ </p>
+ <p>And like any good maps, it should include a legend.<br>
+ <a
+ href="/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example2.map&layer=states&zoom=0&mode=browse&root=/tutorial&program=/cgi-bin/mapserv.exe&map_web=template+example2-5.html">
+ Example 2.5- Adding a Legend</a>
+ </p>
+ <form method="get" action="/cgi-bin/mapserv.exe">
+ <!-- The following two variables are user defined variables.
+ MapServer will pass its value to the HTML template if the
+ proper tags are found, in square brackets "[]" -->
+ <input type="hidden" name="root" value="/tutorial">
+ <input type="hidden" name="program" value="/cgi-bin/mapserv.exe">
+ <!-- The map and layer variables are internal MapServer variables.
+ They are required by the mapping application. -->
+ <input type="hidden" name="map" value="/ms4w/apps/tutorial/htdocs/example2.map">
+ <input type="hidden" name="layer" value="states">
+ <input type="hidden" name="zoom" value="0">
+ Proceed to:
+ <!-- The map_web_template variable will replace the TEMPLATE
+ parameter in the WEB object of the MAP file... -->
+ <select name="map_web">
+ <option value="template example2-1.html">
+ Example 2.1: Pan & Zoom Controls
+ </option>
+ <option value="template example2-2.html">
+ Example 2.2: Layer Control
+ </option>
+ <option value="template example2-3.html">
+ Example 2.3: Scalebar
+ </option>
+ <option value="template example2-4.html">
+ Example 2.4: Reference Map
+ </option>
+ <option value="template example2-5.html">
+ Example 2.5: Legend
+ </option>
+ </select>
+ <input type="submit" name="submit" value="Go there!">
+ </form>
+ <hr size="1">
+ <p class="Small" align="center">
+ <a href="sections.html">Back to Sections Page</a> |
+ <a href="section1.html">Back to Section 1</a> |
+ <a href="section3.html">Go to Section 3</a>
+ </p>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
More information about the mapserver-commits
mailing list