[mapserver-commits] r8706 - trunk/docs/tutorial

svn at osgeo.org svn at osgeo.org
Mon Mar 9 12:12:10 EDT 2009


Author: jmckenna
Date: 2009-03-09 12:12:10 -0400 (Mon, 09 Mar 2009)
New Revision: 8706

Added:
   trunk/docs/tutorial/example1-5-map.txt
Log:
add raster mapfile for tutorial

Added: trunk/docs/tutorial/example1-5-map.txt
===================================================================
--- trunk/docs/tutorial/example1-5-map.txt	                        (rev 0)
+++ trunk/docs/tutorial/example1-5-map.txt	2009-03-09 16:12:10 UTC (rev 8706)
@@ -0,0 +1,163 @@
+.. _example1-5-map:
+
+Example1-5.map
+--------------
+
+.. code-block:: mapfile
+
+	# The annotated map file (sort of)
+	# Created by Pericles S. Nacionales for the MapServer tutorial
+	# 20050408
+	#
+	# MapServer map file uses the pound sign (#) to denote the start of a line
+	# comment--each line that needs to be commented has to be prepended with a "#".
+	#
+	# Map files begin with MAP keyword to signify the start of the map object.
+	# Well, the entire map file is THE map object.  Enclosed between MAP and END
+	# at the very bottom of this map file, are keyword/value pairs and other
+	# objects.
+	MAP
+	  IMAGETYPE      PNG24
+	  EXTENT         -97.238976 41.619778 -82.122902 49.385620
+	  SIZE           400 300
+	  SHAPEPATH      "../data"
+	  IMAGECOLOR     255 255 255
+	  FONTSET        "../fonts/fonts.list"
+	  SYMBOLSET      "../symbols/symbols35.sym"
+	
+	  # Layer objects are defined beneath the map object.  You need at least one
+		  # layer defined in your map file before you can display a map...  You can
+	  # define as many layers as you'd like although a limit is typically hard-coded
+	  # in map.h in the MapServer source.  The default limit is set at 100.  You'd
+	  # have to have a very specialized application to need more than 100 layers in
+	  # your application.
+	  #
+	  # Start of LAYER DEFINITIONS ---------------------------------------------
+	  LAYER # States polygon layer begins here
+	    NAME         states
+	    DATA         states_ugl
+	    STATUS       OFF
+	    TYPE         POLYGON
+	
+	    # CLASSITEM defines the non-spatial attribute that you will be using to
+	    # separate a layer into classes.  This attribute will be in the DBF file
+	    # of your shapefile (it will be different for each data format).  In this
+	    # example the shapefile states_ugl has an associated database 
+	    # (states_ugl.dbf) that contains an attribute called "CLASS".  You will be
+	    # using two values in the CLASS attribute to separate the classes (also 
+	    # called themes) used in this layer--land and water.  CLASSITEM is used in 
+	    # association with the EXPRESSION parameter in the CLASS object.  See below.
+	    CLASSITEM    "CLASS"
+	
+	    # The class object is defined within the layer object.  You can define as
+	    # many classes as you need (well, there are limits as with layers, but it's
+	    # senseless to define more than ten on a "normal" layer.  There are
+	    # situations, however, where you might have to do it.)
+	    CLASS
+	      NAME 'States'
+	      EXPRESSION 'land'
+	
+	      # There are styles in a class, just like there are classes in a layer,
+	      # just like there are layers in a map.  You can define multiple styles in
+	      # a class just as you can define multiple classes in a layer and multiple
+	      # layers in a map.
+	      STYLE
+	        COLOR      232 232 232
+	      END
+	    END
+	  END # States polygon layer ends here
+	
+	  # In addition to vector data (shapefiles are vector data), MapServer supports
+	  # a host of raster formats.  In GIS world, one of the most common raster
+	  # formats is GeoTIFF, a TIFF image with geospatial headers.  MapServer also
+	  # supports JPEG, PNG, GIF, and other common formats.  Other raster formats
+	  # supported by MapServer include ESRI Arc/Info grid, HDF and HDF-EOS, NetCDF, 
+	  # Generic raster binaries, OGC Web Map Service (WMS) layers, etc.  Pretty much 
+	  # any raster format you can think of is probably supported, thanks to the
+	  # impressive Geospatial Data Abstraction Library (GDAL, pronounced "GOODALL"
+	  # or GOODLE?).  More information on GDAL is available at http://www.gdal.org.
+	  #
+	  # MapServer 4.x can read and display bitmapped (like GIFs), RGB/A (true
+	  # color), and multispectral (images with more than 3 bands, like raw LandSat
+	  # images) rasters.
+	  LAYER # MODIS raster layer begins here
+	    NAME         modis
+	    DATA         "raster/mod09a12003161_ugl_ll_8bit.tif"
+	    STATUS       OFF
+	    TYPE         RASTER
+	    PROCESSING   "BANDS=1,2,3"
+	    OFFSITE      71 74 65
+	  END # MODIS raster layer ends here
+	
+	  LAYER # States line layer begins here
+	    NAME         states_line
+	    DATA         states_ugl
+	    STATUS       OFF
+	    TYPE         LINE
+	
+	    CLASSITEM    "CLASS"
+	    CLASS
+	      NAME       'State Boundary'
+	      EXPRESSION 'land'
+	      STYLE
+	        SYMBOL     'line5'
+	        COLOR      64 64 64
+	        SIZE       1
+	      END
+	    END
+	  END # States line layer ends here
+	
+	  # Labels can be defined in its own layer.  This is useful if, say, you want
+	  # to label a polygon layer that's covered by another layer.  By keeping the
+	  # label separate from the polygon and placing it near the bottom of the map
+	  # file (so its drawn on, or near the, top), you can still see the label even
+	  # though you might not be able to see the polygon.  It is also a good
+	  # alternate to point symbols.
+	  #
+	  # A label layer is actually defined with ANNOTATION type (This is derived from 
+	  # points, Node IDs for lines, or polygon IDs).
+	  LAYER # States label layer begins here
+	    NAME         states_label
+	    DATA         states_ugl
+	    STATUS       OFF
+	    TYPE         ANNOTATION
+	
+	    CLASSITEM    "CLASS"
+	
+	    # Just like CLASSITEM, LABELITEM defines the database attribute that you
+	    # will be using to draw labels.  In this case, the values of the attribute
+	    # "STATE" will be used to label the states polygons.
+	    LABELITEM    "STATE"
+	
+	    CLASS
+	      EXPRESSION 'land'
+	      STYLE
+	        COLOR      -1 -1 -1
+	      END
+	
+	      # There can be labels in a class, just like there are classes in a layer,
+	      # just like there are layers in a map.  You can define multiple labels in
+	      # a class just as you can define multiple classes in a layer and multiple
+	      # layers in a map.
+	      # MapServer has a very flexible labeling system.  With that flexibility
+	      # comes complexity, specially when using truetype fonts.  Please read 
+	      # through the LABEL section of the MapServer map file documentation at
+	      # http://ms.gis.umn.edu/docs/reference/mapfile for more information.
+	      LABEL
+	        COLOR 132 31 31
+	        SHADOWCOLOR 218 218 218
+	        SHADOWSIZE 2 2
+	        TYPE TRUETYPE
+	        FONT arial-bold
+	        SIZE 12
+	        ANTIALIAS TRUE
+	        POSITION CL
+	        PARTIALS FALSE
+	        MINDISTANCE 300
+	        BUFFER 4
+	      END # end of label
+	    END # end of class
+	  END # States label layer ends here
+	  # End of LAYER DEFINITIONS -------------------------------
+	
+	END # All map files must come to an end just as all other things must come to...
\ No newline at end of file



More information about the mapserver-commits mailing list