22.214.171.124 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_map file=/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/onegeology.map SetEnvIf Request_URI "/fcgi-bin/exemplars/BGS_Bedrock_Geology/wms" MS_map file=/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
Restart 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 map file 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 map file 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 # Root layer name NAME BGS_EN_Bedrock_and_Superficial_Geology STATUS ON SIZE 600 600 #=======================================================================# # EXTENT # Change to appropriate min-x,min-y,max-x,max-y coordinates for your data #=======================================================================# EXTENT -8.6476 49.8639 1.76943 60.8622 #=======================================================================# # Units of the map coordinates. Used for scalebar and scale computations. # UNITS [feet|inches|kilometers|meters|miles|dd] #=======================================================================# UNITS dd SHAPEPATH “data” IMAGECOLOR 255 255 255 #====================================================================# # Use the PNG8 IMAGETYPE when you need to use a 256 colour palette # IMAGETYPE PNG8 #====================================================================# IMAGETYPE PNG OUTPUTFORMAT NAME png DRIVER “AGG/PNG” MIMETYPE “image/png” #====================================================================# # Use the 8 bit MIMETYPE when you need to use a 256 colour palette # MIMETYPE “image/png; mode=8bit“ #====================================================================# IMAGEMODE RGBA ### All colours and alpha based transparency EXTENSION “png” FORMATOPTION “INTERLACE=ON” ### Slow connections will profit from this option END 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 map file (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 #==================================================================================# # OWS_ metadta applies to all available services (WMS, WFS, WCS, SOS...) # WFS_ metadata applies to WFS services only. Values will override an OWS setting # WMS_ metadata applies to WMS services only. Values will override an OWS setting #==================================================================================# OWS_ABSTRACT "The 1:625k DiGMap data covering the whole of the United Kingdom is available in this OGC web service for all uses - including commercial use subject to the conditions in the Access Constraints section and is being served as a contribution to the OneGeology initiative (www.onegeology.org)." 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.” OWS_ADDRESS “Environmental Science Centre” OWS_ADDRESSTYPE “postal” OWS_CITY “Keyworth” OWS_CONTACTELECTRONICMAILADDRESS “firstname.lastname@example.org” OWS_CONTACTFACSIMILETELEPHONE “+44 (0)115 936 3200” OWS_CONTACTINSTRUCTIONS “” OWS_CONTACTORGANIZATION “British Geological Survey” OWS_CONTACTPERSON “Garry Baker” OWS_CONTACTPOSITION “” OWS_CONTACTVOICETELEPHONE “+44 (0)115 936 3100” OWS_COUNTRY “United Kingdom” OWS_ENABLE_REQUEST “*” OWS_FEES “none” OWS_HOURSOFSERVICE “Mon-Fri, 09:00-17:00” #===========================================================================# # OWS_KEYWORDLIST # Put your organisation name and any other information you want to include. # You MUST include “OneGeology” as one of the keywords. # Do NOT use spaces after the commas in the keyword listing. #===========================================================================# OWS_KEYWORDLIST “OneGeology,geology,map,United Kingdom,bedrock,superficial,lithology, lithostratigraphy,age,MD_LANG@ENG,MD_DATE@2011-06-15” #OWS_ONLINERESOURCE “http://another-service/or/some-different-path/ows?” OWS_POSTCODE “NG12 5GG” OWS_ROLE “PointOfContact” OWS_SERVICE_ONLINERESOURCE “http://www.bgs.ac.uk/products/digitalmaps/digmapgb.html” OWS_STATEORPROVINCE “Nottinghamshire” OWS_SRS “EPSG:27700 EPSG:3857 EPSG:4258 EPSG:4326” OWS_TITLE “BGS Bedrock and Superficial geology” 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. 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” WMS_BBOX_EXTENDED ”TRUE” WMS_FEATURE_INFO_MIME_TYPE “text/html” #WMS_ONLINERESOURCE “http://another-service/or/some-different-path/wms?” WMS_SRS “EPSG:4326 EPSG:3857 CRS:84 EPSG:27700 EPSG:4258” END END
You may use the ”WMS_ONLINERESOURCE” (and ”OWS_ONLINERESOURCE” etc) metadata sections to change the service endpoint for your service. For example, you can do this to force users (clients) to always use the IP version of your service rather than the server name (or vice versa), or to force them to always use the cgi-bin version rather than the fcgi-bin version (or vice versa), or to get them to use a different server. That is, you can have an initial GetCapabilities response document that itself advertises a different service endpoint for the subsequent GetMap requests. There are several reasons why you might want to do this; one such reason is when you have an existing service that has multiple layers only some of some of which are conformant to OneGeology and in which the service metadata doesn't otherwise conform to the OneGeology WMS profile. In such an example, you can set up a service that has a GetCapabilities document that is conformant to the OneGeology WMS profile and which advertises only some of the layers of the other service through the use of the ”WMS_ONLINERESOURCE” metadata.
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 .
The new version of the OneGeology Portal supports the display of a number of coordinate systems, not just the default EPSG:4326 and the suggested EPSG:3857. as below:
- Antarctic Polar Stereographic (WGS84) http://spatialreference.org/ref/epsg/3031/
- Lambert Conformal Conic (ETRS89) http://spatialreference.org/ref/epsg/3034/
- NSIDC Sea Ice Polar Stereographic North (WGS84) http://www.spatialreference.org/ref/epsg/3413/
- Web Mercator (WGS84) http://spatialreference.org/ref/sr-org/7483/
- 2D Latitude / Longitude (ETRS89) http://www.spatialreference.org/ref/epsg/4258/
- 2D Latitude / Longitude (WGS84) http://spatialreference.org/ref/epsg/4326/
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: 30 July 2013