MapThat – Creating WMS Legends

Marketing
Marketing
  • Updated

By David Crowther

MapThat___Creating_WMS_Legends_-_1.JPG

Question:

How do you create a Legend for a WMS Layer in MapThat?

Answer:

As long as the source Web Map Service (WMS) is publishing a Legend Capability, MapThat can consume that Legend and render it with your layer.

External WMS Layers:

If the WMS is accessed from an external source e.g. the Environment Agency or Historic England, we will have no control over the Legend that is being published and MapThat will simply show the Legend as it is provided.

For example here is the Legend for Coal Areas, Flood Zones, Conservation Areas and Listed Buildings. Here the supplier is simply publishing either a point icon (for Listed Buildings) or a simple polygon/polyline style for the other WMS layers. In most cases we would expect the WMS Legend icons to reflect the style of the objects as they are shown in the map, thus allowing MapThat users to differentiate between the map layers.

MapThat___Creating_WMS_Legends_-_2.JPG

Internal WMS Layers:

For internal WMS layers we have a lot more control. Cadline’s WMS publisher of choice is GeoServer and using the Style options in GeoServer you can publish your layers with high levels of customisation and styling, all of which are then supported by a default Legend.

For example in GeoServer here is a layer of LSOA polygons that are styled into 3 Rules based on Population values. As part of the Style settings the Title of each Rule is then used to create a Legend which is supplied as part of the WMS.

MapThat___Creating_WMS_Legends_-_3.JPG

In the Styles page click Preview Legend and the Legend is shown, where each Rule is listed with their Title used the category value.

MapThat___Creating_WMS_Legends_-_4.JPG

If required you can edit the Title value for a Rule and the Legend will then be edited. For example we will change the top Rule to say Low Population Count.

MapThat___Creating_WMS_Legends_-_5.JPG

Validate and Apply the change to the XML and then re-preview the Legend to see that the Legend has now been customised.

MapThat___Creating_WMS_Legends_-_6.JPG

…. changing the Title for all 3 Ranges means that the Legend is now fully configured.

MapThat___Creating_WMS_Legends_-_7.JPG

Now shown within MapThat the Legend for this WMS layer reflects the settings in the STYLE file associated to the GeoServer WMS layer.

MapThat___Creating_WMS_Legends_-_8.JPG

Here is another example of how the GeoServer Legend….

MapThat___Creating_WMS_Legends_-_9.JPG

…is now embedded below the layer in MapThat.

MapThat___Creating_WMS_Legends_-_10.JPG

Configure MapThat to Show WMS Legend:

Finally you will need to configure your Layer in the MapThat Admin Forms to use the WMS Legend.

To show the WMS legend in MapThat we have utilised the Legend/Themes panel which sits below the Layer - we don’t use the Layer Icon.

MapThat Themes are generally thematic maps linked to a Layer where we style the Layer based on an attribute e.g. Deprivation Rate.

MapThat___Creating_WMS_Legends_-_11.JPG

Here the Layer is linked to a MapThat THEME called Liverpool Dep Quantile which styles the LSOA polygons using the dep_quantile field.

MapThat___Creating_WMS_Legends_-_12.JPG

This THEME is then linked to the Liverpool Deprivation Layer.

MapThat___Creating_WMS_Legends_-_13.JPG

In the Data Layer Settings for the Liverpool Deprivation Layer, you now have two options related to the THEME associated to it.

  • Render Thematic Legend – This will show the Legend. If unticked then the user cannot see the Legend.
  • Auto Reveal Thematic Legend – This will mean that the Legend Categories are auto shown when the Layers is ticked on.

MapThat___Creating_WMS_Legends_-_14.JPG

For WMS Layers, there is no need to create an extra THEME record and associate it to the WMS layer. Instead MapThat will by default look for any Legend based on the Web Map Service URL that is provided.

So using the above Data Layers Settings you can choose to Show (Render) and Auto Reveal the WMS Legend for your WMS layer. E.g. making the above settings for my PCC Adopted Highways WMS layer means that the WMS Legend is shown and auto opened when the user ticks the layer on.

MapThat___Creating_WMS_Legends_-_15.JPG

If you wish you can change the Data Layer Settings for a WMS and choose to not show the WMS Legend. Here for the Coal Areas WMS we have unticked the Thematic Legend options for the Layer….

MapThat___Creating_WMS_Legends_-_16.JPG

… which means that when the user ticks to display the Coal Areas WMS, the layer loads but no Legend is shown below the Layer Name.

MapThat___Creating_WMS_Legends_-_17.JPG

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.