Configuring the Mapfile

From ARK
Revision as of 16:41, 14 November 2008 by Stuarteve (talk | contribs) (Sample WMS Layer)

Jump to: navigation, search

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).

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)