[mapserver-commits] r8684 - trunk/docs/tutorial
svn at osgeo.org
svn at osgeo.org
Sun Mar 8 17:45:52 EDT 2009
Author: pnaciona
Date: 2009-03-08 17:45:52 -0400 (Sun, 08 Mar 2009)
New Revision: 8684
Modified:
trunk/docs/tutorial/example1-1.txt
Log:
update tutorial example 1.1
Modified: trunk/docs/tutorial/example1-1.txt
===================================================================
--- trunk/docs/tutorial/example1-1.txt 2009-03-08 21:43:06 UTC (rev 8683)
+++ trunk/docs/tutorial/example1-1.txt 2009-03-08 21:45:52 UTC (rev 8684)
@@ -1,14 +1,6 @@
.. _example1-1:
-*****************************************************************************
- Mapfile
-*****************************************************************************
-:Author: Pericles S. Nacionales
-:Contact: pnaciona at gis.umn.edu
-:Author: Jeff McKenna
-:Contact: jmckenna at gatewaygeomatics.com
-
===========
Example 1.1
===========
@@ -17,30 +9,26 @@
image:: http://biometry.gis.umn.edu/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example1-1.map&layer=states&mode=map
-MapServer can create an image and dump it to a local directory or send it directly to the requesting web browser, as in this example. You can view it without the need for an html page, just enter this URL: `http://<insert hostname or IP address here>/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example1-1.map&layer=states&mode=map<http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example1-1.map&layer=states&mode=map>`__ (Remember to replace "<insert hostname or IP address here >" with your web server's name, e.g. "localhost", or its IP address, e.g. "127.0.0.1").
+MapServer can create an image and dump it to a local directory or send it directly to the requesting web browser, as in this example. You can view it without the need for an html page, just enter this URL: `http://<insert hostname or IP address here>/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example1-1.map&layer=states&mode=map<http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example1-1.map&layer=states&mode=map>`__ (Remember to replace "<insert hostname or IP address here>" with your web server's name, e.g. "localhost", or its IP address, e.g. "127.0.0.1").
-This URL can be broken into three parts: the first part, http://<insert hostname or IP address here>/cgi-bin/mapserv.exe?, calls the MapServer CGI program. If you invoke it as is you will get this familiar message:
+This URL can be broken into three parts: the first part, http://<insert hostname or IP address here>/cgi-bin/mapserv.exe?, calls the MapServer CGI program. If you invoke it as is you will get this familiar message:
- ::
-
+::
No query information to decode. QUERY_STRING is set, but empty.
The next three parts are what make up the query string. The query string contains the CGI parameters (variables and their values), with each parameter separated by an ampersand (&). So, looking at the query string, the first parameter "map" has a value "/ms4w/apps/tutorial/htdocs/example1-1.map"--this tells the MapServer CGI program (mapserv or mapserv.exe) what mapfile to process/parse. The next parameter "layer=states", tells mapserv.exe to "turn on" the states layer--recall that we named our layer object "states". The last parameter, "mode=map", tells mapserv.exe what to do with the output from the mapfile. In this case it tells mapserv.exe to dump the image directly to the web browser (the client), without first creating a temporary image on the server. The MapServer "mode" CGI variable takes values other than "map". For example if you use "mode=browse", MapServer will dump the image to a temporary directory on the server. The browse mode will not work now but we'll come back to it again later.
<hr>
-This is what the mapfile looks like (Example1-1.map):
- <iframe width="100%" src="http://biometry.gis.umn.edu/tutorial/example1-1.map" />
+This is what the mapfile looks like (`Example1-1.map<ttp://biometry.gis.umn.edu/tutorial/example1-1.map>`__).
-<hr align="center" width="300">
-
The `mapfile<http://mapserver.gis.umn.edu/doc/mapfile-reference.html>`__ is MapServer's basic configuration mechanism. It is made up of "objects" and each object can have keywords or other objects. It has a hierarchical structure such that some objects fall under other objects... on top of this hierarchy is the MAP object, all other objects belong to it. This example shows a very straightforward heirarchy of objects. As you go through each example, the complexity of these hierarchical trees will increase.
A few quick notes about mapfiles: we define each object in the mapfile with the object name and we close it with "END" and we precede comments with a pound (#) sign.
Let's break "example1-1.map" down by objects. Its structure looks like this:
- ::
+::
MAP
|-LAYER
@@ -59,7 +47,7 @@
**EXTENT**
This parameter specifies the output extent of our map--the bounding box of our initial map. The EXTENT values are given in this format:
- ::
+::
<Lower Left X> <Lower Left Y> <Upper Right X> <Upper Right Y>
@@ -67,13 +55,13 @@
In this example our data is in geographic projection so the units are in decimal degrees. You can use the utility `ogrinfo<http://gdal.osgeo.org/ogr/ogr_utilities.html>`__, which is part of the GDAL/OGR library package, to get the extent of a particular shapefile (or other supported vector formats). Here is the command I used to get the extent for this example:
- ::
+::
ogrinfo -al -so states_ugl.shp
This returned the following output:
- ::
+::
INFO: Open of `states_ugl.shp' using driver `ESRI Shapefile' successful.
Layer name: states_ugl
@@ -101,7 +89,8 @@
This is the background color of your map. The values are RGB values so 255 Red, 255 Green, and 255B which results in a white background. Go ahead and play with this values.
Now let's look at the LAYER object parameters:
-**LAYER
+
+**LAYER**
Marks the beginning of a LAYER within the MAP object. You can specify as many layers as you'd like although you are limited to 100, by default. To change this limit, you will have to edit the map.h header file (in the soure tree) and recompile MapServer.
**NAME**
More information about the mapserver-commits
mailing list