4.5 Configuring group layering
In some situations, for example when you have too many individual layers, or if you have to comply with some strict naming conventions (such as INSPIRE) you may need to consider configuring group layering. In group layering you nest one set of layers inside another (group) layer, you can still call (e.g. make a GetMap request on) any of the individual grouped layers or you can call all the grouped layers at the same time using the grouping layer. For example in the below MapServer GetCapabilities response on a service with group layers you could make a GetMap request on the group layer called GE.GeologicFault and would get a map comprising both the grouped layers (GE.GeologicFault_GBR_BGS_EN_1M_Surface and GE.GeologicFault_GBR_BGS_EN_1M_Bedrock), or you could perform a GetMap request on either of the individual layers.
To configure group layering in MapServer first you need to configure a service with all the layers that need to be grouped. The next step is to add a GROUP keyword (with the name of the group layer) into the LAYER section of all the layers you want to be grouped together. Finally, in ONE of the METADATA sections of the layers you want to group you need to add a WMS_GROUP_TITLE and a WMS_GROUP_ABSTRACT value. For example in the MapServer service configuration file for the above GetCapabilities response we have the following configuration:
LAYER GROUP "GE.GeologicFault" NAME GE.GeologicFault_GBR_BGS_EN_1M_Surface TYPE LINE STATUS ON EXTENT -8.01697 49.9678 0.715821 60.8368 MAXSCALEDENOM 3000000 CONNECTIONTYPE ogr CONNECTION "data2/OGE.mdb" DATA "V5_625k_ONEGEOLOGY_FAULTS_AT_SURFACE" PROCESSING "CLOSE_CONNECTION=DEFER" OPACITY 100 TOLERANCE 10 TOLERANCEUNITS pixels TRANSFORM TRUE # Same template OK for surface and bedrock faults HEADER "templ/OGE_1M_bedrock_GeologicStructure_headerGSMLP.html" TEMPLATE "templ/OGE_1M_bedrock_GeologicStructure_bodyGSMLP.html" FOOTER "templ/OGE_1M_bedrock_GeologicStructure_footerGSMLP.html" PROJECTION "init=epsg:4326" END METADATA INCLUDE "../DefaultMapIncludes/BGS-Attribution.map" "OWS_TITLE" "BGS 1:1 Million surface geologic structure" "OWS_ABSTRACT" "BGS surface fault geology originally created for OneGeology Europe" "OWS_EXTENT" "-8.01697 49.9678 0.715821 60.8368" "OWS_SRS" "CRS:84 EPSG:27700 EPSG:3034 EPSG:4258 EPSG:4326" "GML_INCLUDE_ITEMS" "all" "GML_FEATUREID" "OBJECTID" "OWS_METADATAURL_HREF" "http://www.bgs.ac.uk/discoverymetadata/13480426.html" "OWS_METADATAURL_FORMAT" "text/html" "OWS_METADATAURL_TYPE" "TC211" "OWS_DATAURL_HREF" "http://www.bgs.ac.uk/products/digitalmaps/digmapgb_625.html" "OWS_DATAURL_FORMAT" "text/html" "OWS_KEYWORDLIST" "OneGeology,continent@Europe,subcontinent@Northern Europe,geographicarea@United Kingdom, serviceprovider@British Geological Survey,dataprovider@British Geological Survey,thematic@Harmonized structure, thematic@Surface geology,DS_TOPIC@geoscientificinformation,DS_DATE@2010,thematic@Structure,thematic@Fault" "WFS_SRS" "EPSG:4326 EPSG:27700 EPSG:3034 EPSG:4258" "WMS_GROUP_TITLE" "Geologic Faults" "WMS_GROUP_ABSTRACT" "MappedFeature (spatial objects whose specification property is of type ShearDisplacementStructure)" END INCLUDE "FaultTypeClassesIn3.map" END LAYER GROUP "GE.GeologicFault" NAME GE.GeologicFault_GBR_BGS_EN_1M_Bedrock EXTENT -8.09708 49.9678 0.781767 60.8368 TYPE LINE STATUS ON MAXSCALEDENOM 3000000 CONNECTIONTYPE ogr CONNECTION "data2/OGE.mdb" DATA V5_625k_ONEGEOLOGY_FAULTS PROCESSING "CLOSE_CONNECTION=DEFER" OPACITY 100 TOLERANCE 10 TOLERANCEUNITS pixels TRANSFORM TRUE HEADER "templ/OGE_1M_bedrock_GeologicStructure_headerGSMLP.html" TEMPLATE "templ/OGE_1M_bedrock_GeologicStructure_bodyGSMLP.html" FOOTER "templ/OGE_1M_bedrock_GeologicStructure_footerGSMLP.html" PROJECTION "init=epsg:4326" END METADATA INCLUDE "../DefaultMapIncludes/BGS-Attribution.map" "OWS_TITLE" "BGS 1:1 Million bedrock geologic structure" "OWS_ABSTRACT" "BGS bedrock fault geology originally created for OneGeology Europe. The bedrock fault layer shows faults with superficial deposits (Quaternary and Recent) removed." "OWS_EXTENT" "-8.09708 49.9678 0.781767 60.8368" "OWS_SRS" "CRS:84 EPSG:27700 EPSG:3034 EPSG:4258 EPSG:4326" "GML_INCLUDE_ITEMS" "all" "GML_FEATUREID" "OBJECTID" "OWS_METADATAURL_HREF" "http://www.bgs.ac.uk/discoverymetadata/13480426.html" "OWS_METADATAURL_FORMAT" "text/html" "OWS_METADATAURL_TYPE" "TC211" "OWS_DATAURL_HREF" "http://www.bgs.ac.uk/products/digitalmaps/digmapgb_625.html" "OWS_DATAURL_FORMAT" "text/html" "OWS_KEYWORDLIST" "OneGeology,continent@Europe,subcontinent@Northern Europe,geographicarea@United Kingdom, serviceprovider@British Geological Survey,dataprovider@British Geological Survey, thematic@Harmonized structure,thematic@Bedrock,DS_TOPIC@geoscientificinformation, DS_DATE@2010,thematic@Structure,thematic@Fault" "WFS_SRS" "EPSG:4326 EPSG:27700 EPSG:3034 EPSG:4258" END INCLUDE "FaultTypeClassesIn3.map" END
Section last modified: 19 October 2015