184.108.40.206 BGS exemplar service (SERVICE configuration)
The first part of this section helps you set up a new map service (with a service name appropriate to your data) which, at this stage, uses one of the exemplar datasets as the data source. The second part of the section helps you configure this new service so it can serve your own data.
Inside the \ms4w\apps\cookbookExemplars folder you will find two folders: "BGS_Bedrock_and_Superficial_Geology" and "BGS_Bedrock_Raster_Map". These folders contain the exemplar data, and map configuration files.
We will assume you are basing your service on the BGS_Bedrock_and_Superficial_Geology example; substitute with BGS_Bedrock_Raster_Map if that is closer to your requirements. When you have decided which exemplar service is most suitable for your needs, you should copy that exemplar folder to a new folder that will be your new service.
Note the names of these folders do not have to match the names of the service, but you would be advised to ensure that the folder name gives some hint as to its contents and purpose. For example we call one of our exemplar folders "BGS_Bedrock_Raster_Map" to indicate that this service application holds a raster map as datasource, rather than a shapefile.
Make more copies with appropriate names if you are also making multiple language services.
Inside this folder there is a wwwroot\index.html file. This has some example queries which will enable you to test your service when you have set it up. For these to work for your new service you will need to edit the file and change all occurrences of the string "BGS_Bedrock_and_Superficial_Geology" with the name you have created for your service.
Now you will need to create an httpd conf file in the \ms4w\httpd.d\ folder that has the same name as your service; for example, the "BGS_Bedrock_and_Superficial_Geology" exemplar service has a conf file called "httpd_BGS_Bedrock_and_Superficial_Geology_Exemplar.conf" and the "BGS_Bedrock_Geology" exemplar service has a corresponding conf file called "httpd_BGS_Bedrock_Geology.conf"
You need to copy one of the exemplar .conf files and rename it to match the name of your service, you will then need to change the paths in the file to match your service name and folder configuration.
Using the raster exemplar service (as shown below), you will need to change all references to "BGS_Bedrock_Geology" to match the name of your service, and all references to "BGS_Bedrock_Raster_Map" to match the name of your app folder. Note, you do not need to add the drive letter.
Alias /BGS_Bedrock_Geology/ "/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/wwwroot/" <Directory "/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/wwwroot/"> AllowOverride None Options Indexes FollowSymLinks Multiviews Order allow,deny Allow from all </Directory> SetEnvIf Request_URI "/cgi-bin/exemplars/BGS_Bedrock_Geology/wms" MS_MAPFILE=/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/onegeology.map SetEnvIf Request_URI "/fcgi-bin/exemplars/BGS_Bedrock_Geology/wms" MS_MAPFILE=/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/onegeology.map
Again make more copies if making multiple language services.
Now you should edit the index.html file in the Apache web root \ms4w\Apache\htdocs\ and add a link to your new service. Note, the link you use is the value of the Alias (line one of the httpd conf file).
Test your service
Re-start the Apache service using the Services control panel and then reload the http://localhost page in your browser. You should get the index.html page with the link to your new service. If you follow the link you should find a page with some test requests for some of the exemplar layer data.
Configure your new service
Next you need to configure your own data with the service. You can use the example UK geology layers as a guide to creating your own shapefile based layers. The BGS_Bedrock_Raster_Map directory provides a layer you can use as a guide for a raster file based layer. The example uses an 8-bit palette PNG with transparent background and world file for georeferencing. You could also use a 32-bit TIFF file with alpha layer transparency and world file for georeferencing or GeoTIFF file with georeferencing information incorporated inside the file. Refer to the MapServer documentation for further details on raster formats or post a question to the OneGeology help forum if you have further questions.
You should remove the examples in your own folders and all the BGS_Bedrock_and_Superficial_Geology files when you have finished i.e. make sure that you do not serve to the WWW the BGS dataset! We will soon see if more than one web server is serving it! The BGS 625k dataset and configuration is provided in the template application so that you can see everything that is required to set up a real OneGeology Level 1 WMS service including real metadata and example WMS service layer Names, Titles, Keywords etc.
First you should copy your source date (shapefiles or rasters) to your renamed version of the apps\ BGS_Bedrock_and_Superficial_Geology\data directory. Next you need to edit the OneGeology mapfile appropriately for your server.
There are comments included to indicate where you need to edit values. The important sections are reproduced below with comments.
At the top of the mapfile you will need to edit the EXTENT and UNITS lines shown in the extract below. The below example specifies units of decimal degrees and an extent (minx miny maxx maxy) covering the whole of the United Kingdom. You should change these according to the map units in your data files and their total extent.
MAP NAME BGS_EN_Bedrock_and_Superficial_Geology # Root layer name STATUS ON SIZE 600 600 EXTENT -8.6476 49.8639 1.76943 60.8622 # Change to appropriate coordinates for your data UNITS dd # UNITS [feet|inches|kilometers|meters|miles|dd] Units of the map coordinates. # Used for scalebar and scale computations. SHAPEPATH “data” IMAGECOLOR 255 255 255 OUTPUTFORMAT NAME png DRIVER “AGG/PNG” MIMETYPE “image/png” ### MIMETYPE “image/png; mode=8bit” ### Use the 8 bit MIMETYPE when you need to use a 256 colour palette IMAGEMODE RGBA ### All colours and alpha based transparency EXTENSION “png” FORMATOPTION “INTERLACE=ON” ### Slow connections will profit from this option END IMAGETYPE PNG # IMAGETYPE PNG8 # Use the PNG8 IMAGETYPE when you need to use a 256 colour palette PROJECTION “init=epsg:4326” END
Note, the use of the GD/PNG renderer is deprecated in MapServer 6.0.0, you should switch to using the AGG renderer (as shown above). If you require a 256 color paletted image, then you can use the builtin png8 imagetype, by specifying MIMETYPE “image/png; mode=8bit”
The next (WEB) section of the mapfile (extract shown below) sets general information for your web service including a general description, contact information, etc. You can edit it according to the comments included in the example.
WEB HEADER “templates/query_header.html” FOOTER “templates/query_footer.html” IMAGEPATH “/ms4w/tmp/ms_tmp/” IMAGEURL “/ms_tmp/”
In the following (METADATA) section(s) instead of the "WMS_" prefix you may use "OWS_" prefix. The OWS_ prefix is used by WMS, WFS, WCS, GML, and other services, so you only have to specify that metadata type once. If you have "OWS_ABSTRACT" and "WMS_ABSTRACT", the "OWS_ABSTRACT" will be used by any WFS / WCS service whilst the "WMS_ABSTRACT" will be used by the WMS.
METADATA WMS_BBOX_EXTENDED "TRUE" OWS_ENABLE_REQUEST "*" OWS_TITLE “BGS Bedrock and Superficial geology” WMS_ABSTRACT “The 1:625k DiGMap data covering the whole of the United Kingdom is available in this OGC WMS service for your personal, non-commercial use only and is being served as a contribution to the OneGeology initiative (www.onegeology.org). Separate bedrock geology and superficial deposits layers are available in this service. Layers available for bedrock are lithostratigraphy, age, and lithology. Layers available for superficial deposits layer are lithostratigraphy and lithology. For information about more of the British Geological Survey's maps that are available digitally please visit http://www.bgs.ac.uk/products/digitalmaps/digmapgb.html” # Put your organization name and any other information you want to include. WFS_ABSTRACT “The 1:625k DiGMap data covering the whole of the United Kingdom is available in this OGC WFS service for your personal, non-commercial use only and is being served as a contribution to the OneGeology initiative(www.onegeology.org). The contents of this WFS service are not intended for direct use but are transformed by a mediator layer into separate WFS services which provide data in GeoSciML. This process is described in Chapter 2 of the OneGeology WFS Cookbook available at www.onegeology.org. # Put your organization name and any other information you want to include. # You must include “OneGeology” as one of the keywords. OWS_KEYWORDLIST “OneGeology,geology,map,United Kingdom,bedrock,superficial,lithology, lithostratigraphy,age,MD_LANG@ENG,MD_DATE@2011-06-15” OWS_SERVICE_ONLINERESOURCE “http://www.bgs.ac.uk/products/digitalmaps/digmapgb.html” OWS_CONTACTPERSON “Keith Westhead” OWS_CONTACTORGANIZATION “British Geological Survey” OWS_CONTACTPOSITION “Head of Information Delivery” OWS_ADDRESSTYPE “postal” OWS_ADDRESS “Murchison House” OWS_CITY “Edinburgh” OWS_STATEORPROVINCE “West Lothian” OWS_POSTCODE “EH9 3LA” OWS_COUNTRY “UK” OWS_CONTACTVOICETELEPHONE “+44 (0)131 667 1000” OWS_CONTACTFACSIMILETELEPHONE “+44 (0)131 668 2683” OWS_CONTACTELECTRONICMAILADDRESS “firstname.lastname@example.org” OWS_FEES “none” OWS_ACCESSCONSTRAINTS “The 1:625k DiGMap data is available for free download for your personal, teaching, research, or non-commercial use (as described on http://www.bgs.ac.uk/about/copyright/non_commercial_use.html). Your use of any information provided by the British Geological Survey (BGS) is at your own risk. Neither BGS nor the Natural Environment Research Council (NERC) gives any warranty, condition, or representation as to the quality, accuracy, or completeness of the information or its suitability for any use or purpose. All implied conditions relating to the quality or suitability of the information, and all liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law.” WMS_FEATURE_INFO_MIME_TYPE “text/html” WMS_SRS “EPSG:4326 EPSG:3857 CRS:84 EPSG:27700 EPSG:4258” END END
The SRS specifies the coordinate system that the WMS can serve data in. These are commonly specified using EPSG codes and must include EPSG:4326 so that all services have at least one coordinate system in common. We would like if you could specify the Spherical Mercator projection (EPSG:3857) to allow your service to be used in Google Maps. You may specify other systems that are appropriate for your region if you wish; for example we would expect most European services to support EPSG:4258 (The European Terrestrial Reference System 1989 ~ ETRS89).
For a 2 star accredited service ALL OneGeology layers must supply a LatLonBoundingBox defined using SRS EPSG:4326 [WGS1984 latitude/longitude].
For a 2 star accredited service ALL OneGeology layers must support EPSG:4326.
Each layer must supply a list of the SRS it supports
You can find out more information about EPSG codes . The file ms4w\proj\nad\EPSG in your MS4W distribution contains a list of EPSG codes and their projection parameters in a form that the PROJ library used by MapServer can understand. Hopefully, this should cover all cases. If you do not find your system there you could try looking in some of the other files in the "nad" directory and copying the appropriate line or following some of the links given in the MapServer FAQ at where-do-i-find-my-epsg-code . You might also try posting a question to the OneGeology self-help help desk forum to see if any projection system specialist can help you.
You must then create "LAYER" sections for each map (e.g. Bedrock map, superficial geology map etc.) that you are going to serve. The contents of these LAYER sections will depend on whether your data is in shapefile format or a raster image. Examples are given below with comments where you will need to edit them according to your own data.
Section last modified : 08 September 2011.