Difference between revisions of "Configuring the Mapfile"

From ARK
Jump to: navigation, search
(Sample WMS Layer)
(Example Mapfile)
 
(2 intermediate revisions by the same user not shown)
Line 12: Line 12:
  
 
Some things to take care with are the directory locations - as you will need to make sure these match your file structure (especially if you are using *nix).
 
Some things to take care with are the directory locations - as you will need to make sure these match your file structure (especially if you are using *nix).
 +
 +
There are additional comments on the examples below (prefixed with ####).
  
 
====Header====
 
====Header====
Line 100: Line 102:
  
 
====Sample WFS Layer (in ark_wfs.map)====
 
====Sample WFS Layer (in ark_wfs.map)====
 +
 +
  LAYER
 +
  CONNECTION "C:/ms4w/Apache/htdocs/tutorial_ark/data/mapping/cxt_schm.shp"
 +
  CONNECTIONTYPE OGR
 +
  GROUP "cxt"
 +
  NAME cxt_schm #### VERY IMPORTANT that this name starts with the three letter mod and an underscore (cxt_)
 +
  STATUS DEFAULT
 +
  TEMPLATE "/srv/www/htdocs/tutorial_ark/mapserver/templates/dummy_template.html"
 +
  TYPE POLYGON
 +
  UNITS METERS
 +
  DUMP TRUE
 +
  METADATA
 +
    "wfs_title" "Context Schematic"
 +
    "gml_featureid" "ark_id"  #### Make sure these are here - else your results won't be served
 +
    "gml_include_items" "all"  #### Make sure these are here - else your results won't be served
 +
  END
 +
  CLASS
 +
    NAME ""
 +
    STYLE
 +
      ANGLE 360
 +
      COLOR 0 45 60
 +
      OPACITY 40
 +
      OUTLINECOLOR 0 45 60
 +
      SYMBOL 0
 +
    END
 +
  END
 +
  END

Latest revision as of 16:47, 14 November 2008

Initial Setup

You need to ensure that Mapserver is setup to server as a WMS/WFS server. If you are not sure, please visit WMS Server HowTo and WFS Server HowTo.

The mapfiles themselves need to be setup manually per Mapserver setup - ARK will not write these for you unfortunately, so its worth undertaking the mapfile setup alongside the official mapfile documentation.

Example Mapfile

ARK uses two different mapfiles, the ark_wfs.map and ark_wms.php. These are found within the ark directory structure in mapserver/mapfiles/.

The files themselves should be reasonably self-explanatory if you have used Mapserver before.

Some things to take care with are the directory locations - as you will need to make sure these match your file structure (especially if you are using *nix).

There are additional comments on the examples below (prefixed with ####).

Header

 MAP
   NAME "ARK WMS Map"
   IMAGETYPE      PNG24
   EXTENT 533866 180940 533963 181000 ####Make sure this is valid
   SIZE           600 400
   SHAPEPATH      "C:/ms4w/Apache/htdocs/tutorial_ark/data/mapping/" ####Path to the shapefiles on the server
   IMAGECOLOR     250 250 250 #### Background colour
   FONTSET        "C:/ms4w/Apache/htdocs/tutorial_ark/mapserver/fonts/fonts.list" #### change this to match the location on your server
   SYMBOLSET      "C:/ms4w/Apache/htdocs/tutorial_ark/mapserver/symbols/symbols35.sym"  #### change this to match the location on your server
   DEBUG ON
   WEB
     METADATA
     "wms_name"	"ARK WMS"
     "wms_title"	"ARK WMS"
     "wms_onlineresource"	"http://www.lparchaeology.com/prescot/ark/php/map/ark_wxs_server.php" #### change this your online address
     "wms_srs"  "EPSG:27700" #### This is default to British National Grid - you may want to change to "EPSG:4326" (LatLongs)
     "wms_feature_info_mime_type" "text/html"
     "wms_server_version" "1.1.1"
     END
     IMAGEPATH 'C:/ms4w/Apache/htdocs/tutorial_ark/mapserver/tmp/'
     IMAGEURL '/mapserver/tmp/'
     MAXSCALE 20000000
     MINSCALE 500
     LOG '/srv/www/htdocs/fasti/mapserver/mapfiles/ms_log.txt'
  END
  OUTPUTFORMAT
     NAME "png"
     MIMETYPE "image/png"
     DRIVER "GD/PNG"
     EXTENSION "png"
     IMAGEMODE "RGB"
  END
  PROJECTION
  #  Basic initial projection should be in ETRS89 / ETRS-LCC
  #  This projection will also be dynamically set by the PHP
      "init=epsg:27700"  #### Make sure this matches the wms_srs set above
  #
  END
  #

Sample WMS Layer (in ark_wms.map)

  LAYER 
   NAME         "contexts"
   CONNECTION "C:/ms4w/Apache/htdocs/tutorial_ark/data/mapping/cxt_schm.shp"
   CONNECTIONTYPE OGR
   TEMPLATE "C:/ms4w/Apache/htdocs/tutorial_ark/mapserver/templates/dummy_template.html"
   GROUP "cor"
    METADATA
     "lyrname"	"Contexts"
     "grpname"	"Contexts"
     END
   SIZEUNITS PIXELS
   STATUS ON
   TOLERANCEUNITS PIXELS
   OFFSITE 0 0 0
	TRANSPARENCY 65
   TYPE POLYGON
   UNITS METERS
   LABELITEM "ark_id"
   CLASS
     NAME "Contexts"
     TEXT (Context:[ark_id])
     LABEL
         ANGLE auto
         ANTIALIAS FALSE
         BACKGROUNDCOLOR 60 200 219
         #BUFFER 5
         COLOR 0 45 60
         FONT arial
         FORCE FALSE
         MINDISTANCE 10
         MINFEATURESIZE 30
         PARTIALS FALSE
         SIZE 8
         TYPE TRUETYPE
       END
     STYLE
       COLOR 10 150 169
       OUTLINECOLOR 5 98 115
     END
   END
 END

Sample WFS Layer (in ark_wfs.map)

 LAYER
 CONNECTION "C:/ms4w/Apache/htdocs/tutorial_ark/data/mapping/cxt_schm.shp"
 CONNECTIONTYPE OGR
 GROUP "cxt"
 NAME cxt_schm #### VERY IMPORTANT that this name starts with the three letter mod and an underscore (cxt_)
 STATUS DEFAULT
 TEMPLATE "/srv/www/htdocs/tutorial_ark/mapserver/templates/dummy_template.html"
 TYPE POLYGON
 UNITS METERS
 DUMP TRUE
 METADATA
   "wfs_title" "Context Schematic"
   "gml_featureid" "ark_id"  #### Make sure these are here - else your results won't be served
   "gml_include_items" "all"  #### Make sure these are here - else your results won't be served
 END
 CLASS
   NAME ""
   STYLE
     ANGLE 360
     COLOR 0 45 60
     OPACITY 40
     OUTLINECOLOR 0 45 60
     SYMBOL 0
   END
 END
 END