OS MasterMap Topography Layer contains features that represent objects in the physical environment, such as buildings, fields, fences, and letter boxes. It also includes intangible objects, such as county boundaries and the lines of mean high or low waters. There are over 500 million features in the product.
Ordnance Survey has developed a post-processing styling method that creates a cartographic styling utilizing discrete style attributes (style_code, colour_code, font_code and more) to ensure that users get the most out of the rich content available OS MasterMap Topography Layer. This guide describes this styling method and the related resources provided by Ordnance Survey, and shows you how to use the resources in various geographical information systems (GIS).
A number of methods have been developed to style OS MasterMap Topography Layer over time:
featurecode: This is the easiest method, but it provides only a limited number of styles and can result in mis-styled features when the same featurecode is used for multiple feature types.
featurecode and make: This method makes it possible to distinguish between features that share the same featurecode but have different values for ‘make’. A good example of this is Rail:
featurecode = 10167 AND make = ‘Manmade’
featurecode = 10167 AND make = ‘Natural’
This method is used in the open source stylesheets on the QGIS-UK/Styles GitHub repository.
descriptiveGroup, descriptiveTerm and make: How to use these three descriptive attributes is outlined in the OSMM Topography Layer - Standard Styling Specification.
descriptiveGroup, descriptiveTerm, make and physicalPresence: Using these four descriptive attributes provides access to the richness of the OS MasterMap Topography Layer data but is the most difficult method to implement.
Custom style attribute: A few Partners have implemented the creation of a new style attribute during the loading/processing of OS MasterMap Topography Layer. This gives features a discrete attribute on which to style that is far more efficient.
OS discrete styling attribute: Several years ago, we released Styled Layer Descriptors (SLDs) for OS MasterMap Topography Layer that used a discrete style attribute called os_cat. This attribute is a textual description (for example, buildingFill) that is created by post processing the data.
Multiple available styling methods made it difficult to provide uniform guidance for OS MasterMap Topography Layer, because the stylesheets look for a particular attribute field, which may not exist in the translated data. For example, descriptiveGroup can become descgroup or desc_group or DESCRIPTIVEGROUP.
The following resources provide additional information about the concepts in this guide:
Oracle INSTR Function - https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_1103.htm#OLADM564
PostgreSQL MVCC - http://www.postgresql.org/docs/current/static/mvcc-intro.html
PostgreSQL Pattern Matching - http://www.postgresql.org/docs/9.4/static/functions-matching.html
PostgreSQL Array Operators - http://www.postgresql.org/docs/9.4/static/functions-array.html
OGC Style Layer Descriptor - http://www.opengeospatial.org/standards/sld
The stylesheets are available in the directory of the GitHub repository.
You can either fork the stylesheets from the GitHub repository or download the repository and extract the files.
Four different types of stylesheets are provided (SLD, LYR, LYRX and QML) to help users apply the styles in as many applications as possible. Each stylesheet type is discussed in a separate section below.
A Mapbox style is a document that defines the visual appearance of a map: what data to draw, the order to draw it in, and how to style the data when drawing it. A style document is a JSON object with specific root level and nested properties. This specification defines and describes these properties.
The Mapbox GL styles (.json) for OS MasterMap Topography Layer Vector Tiles are for use in Mapbox Studio, Maputnik and other compatible software.
They have been designed to work with the data as it is supplied.
The fonts and sprites required for each style are supplied for if you want to use the styles offline/locally. You will need to host these locally and input the host locations into the .json file where prompted.
The following tables show the attributes used to create the new style rules.
Feature Code | Style Description | Style Code |
---|---|---|
Descriptive Group | Descriptive Term | Make | Style Description | Style Code | Font Code* | Colour Code** |
---|---|---|---|---|---|---|
This section contains instructions on how to use the scripts in various databases (PostgreSQL/PostGIS, Oracle and SQL Server) and an overview of the key principles on which the scripts are based.
The SQL scripts are available in the SQL directory of the GitHub repository.
Before using the SQL scripts, you need to determine how your OS MasterMap Topography Layer loading software handles the descriptiveGroup and descriptiveTerm attributes, because these attributes often contain multiple values. Some loaders use a simple VARCHAR(254) data type and load in the data as a comma separated list of values, while others load in the data as an array. For example, this is what a descriptiveTerm with multiple values, looks like when loading OS MasterMap Topography Layer data using:
FME: Rough Grassland,Scrub,Heath
GDAL/OGR2OGR library: {“Rough Grassland”,Scrub,Heath}
This is an important distinction as it determines which SQL queries you can use to find the different descriptiveGroup and descriptiveTerm values. If you are unsure which method your loader uses, look at the data in your database or at the CREATE TABLE SQL statement that was used. Either of these will show you the data type of each attribute field. For example, in PostgreSQL/PostGIS using OGR2OGR, if the descriptive term field was created as descriptiveterm character varying[], it is an ARRAY. When you know this, you can choose the correct SQL query script to use.
Before running the SQL scripts, please check your schema and table names as these may be different from those used in our SQL queries. You can use find and replace in a text editor to tweak the SQL queries to match your database configuration.
To overcome the challenges posed by multiple styling methods and to ensure that users get the most out of the detailed content available, Ordnance Survey developed a post-processing method to create a new discrete style attribute that can be used to style OS MasterMap Topography Layer.
We created a key attribute, “style_code”, which is populated with integers that correspond to a style for a given feature. This code is based on logic similar to the process described in our Standard Styling Specification, but with far fewer unique feature styles. We chose to use integers, rather than text, to improve system performance during processing. The use of integers, together with a text description, makes the new styling easy to understand and apply.
Styling information, SQL scripts, stylesheets and related resources are available from the GitHub repository.
To support the wide variety of OS MasterMap users, the provided resources include:
Stylesheets: In SLD (Geoserver), LYR (ESRI Layer), LYRX (ArcGIS Pro), QML (QGIS) formats in a backdrop style, and Mapbox GL styles.
SQL database scripts: For Oracle, PostgreSQL/PostGIS and SQL Server to post process your database.
Symbology fonts: OSMasterMap TrueType font and SVG images.
FME: Transformer(s) for FME Workbench.
QGIS-Field Calculator: Text files and instructions on how to use the QGIS field calculator to add styling attribution.
To create the post-processing styling method, we followed these steps:
Queried the OS MasterMap Topography Layer database to create a list of discrete features grouped by combinations of descriptiveGroup, descriptiveTerm, make and physicalPresence. The results were ordered by total count.
Added a styling description for each combination.
This was done by the Cartographic Design team who considered whether each discrete feature should have its own style rule or whether it could be styled like a similar feature.
Added a numerical styling code.
This was based on previous feedback from users who had used the “os_cat” styling method. Using numbers has
important performance benefits; a stylesheet looking to match data with “Building Outline Line” is significantly slower than one matching with an integer value of “2”, for example.
Wrote SQL database scripts that post processes the database tables to add the new styling attributes, and stylesheets that look for the new style code attribute.
Descriptive Group | Descriptive Term | Make | Style Description | Style Code |
---|---|---|---|---|
Descriptive Group | Descriptive Term | Make | Style Description | Style Code |
---|---|---|---|---|
Descriptive Group | Descriptive Term | Make | Physical Presence | Style Description | Style Code |
---|---|---|---|---|---|
Descriptive Group | Descriptive Term | Style Description | Style Code |
---|---|---|---|
Total count | feature Code | descriptive Group | descriptive Term | make | physical Presence | Styling description | Code |
---|
The contains tables that list the attributes used to create the new style rules for each OS MasterMap Topography Layer type.
10136
Parish Boundary
1
10131
District Boundary
2
10128
Electoral Boundary
3
10127
County Boundary
4
10135
Parliamentary Boundary
5
10091
Culvert Symbol
1
10082
Direction Of Flow Symbol
2
10130
Boundary Half Mereing Symbol
3
10066 or 10170
Bench Mark Symbol
4
10165
Railway Switch Symbol
5
10177
Road Related Flow Symbol
6
Contains ‘Buildings or Structure’
-
-
Building Text
1
1
1
Contains ‘Inland Water’
-
-
Water Text
2
2
2
Contains ‘Road or Track’
-
-
Road Text
3
1
1
Terrain and Height
-
-
Height Text
4
1
3
Contains ‘Roadside’
-
-
Roadside Text
5
1
1
Contains ‘Structure’
-
-
Structure Text
6
2
1
Political or Administrative
-
-
Administrative Text
7
1
5
General Surface
-
Natural
General Surface Natural Text
8
1
1
General Surface
-
Manmade or IS NULL
General Surface Manmade Text
9
1
1
Landform
-
Natural
Landform Natural Text
10
1
4
-
Foreshore
-
Foreshore Text
11
1
4
Contains Tidal Water
-
-
Tidal Water Text
12
2
2
Built Environment
-
-
Built Environment Text
13
1
1
Contains ‘Historic Interest’
-
-
Historic Text
14
3
1
Rail
-
-
Rail Text
15
1
1
Contains ‘General Feature’
-
-
General Feature Text
16
1
1
Landform
-
Manmade
Landform Manmade Text
17
1
4
* Required font 1 = Arial, 2 = Arial Italic, 3 = Times New Roman Italic
** Text colour 1 = Black, 2 = Blue, 3 = Orange, 4 = Brown, 5 = Purple
Contains ‘Buildings’
-
-
Building Text
1
-
-
Water Text
2
Is NULL
Manmade
Building Fill
1
Contains ‘General Surface’
Multi Surface
Multiple
Multi Surface Fill
2
Contains ‘General Surface’
Is NULL
Natural
Natural Fill
3
Contains ‘Road or Track’
Is NULL
Manmade
Road Or Track Fill
4
Contains ‘General Surface’
Is NULL
Manmade or Unknown
Manmade Fill
5
Contains ‘Roadside’
-
Natural
Roadside Natural Fill
6
Contains ‘Roadside’
-
Manmade or Unknown
Roadside Manmade Fill
7
Contains ‘Inland Water’
Is NULL
-
Inland Water Fill
8
Contains ‘Path’
-
-
Path Fill
9
Contains ‘Road or Track’
Track
-
Track Fill
10
-
Slope
-
Slope Fill
11
Contains ‘Structure’
Is NULL OR Upper Level OF Communication OR Overhead Construction
-
Structure Fill
12
-
Cliff
-
Cliff Fill
13
-
Step
-
Step Fill
14
-
Foreshore
-
Foreshore Fill
15
-
Traffic Calming
-
Traffic Calming
16
Glasshouse
-
-
Glasshouse Fill
17
Contains ‘Rail’
Is NULL
Natural
Rail Natural Fill
18
-
Pylon
-
Pylon Fill
19
Contains ‘Building’
Archway
-
Archway Fill
20
Contains ‘Landform’
-
Natural
Landform Natural Fill
21
Contains ‘Tidal Water’
Is NULL
-
Tidal Water Fill
22
Contains ‘Landform’
-
Manmade
Landform Manmade Fill
23
Rail
Is NULL
Manmade or Unknown
Rail Manmade Fill
24
-
-
-
Building Text
1
-
-
Water Text
2
Contains a form of Nonconiferous Trees OR/AND a form of Coniferous Trees
-
Mixed Woodland Fill
25
-
Contains a form of Nonconiferous Trees
-
Nonconiferous Tree Fill
26
-
Contains a form of Coniferous Trees
-
Coniferous Tree Fill
27
-
Contains Orchard
-
Orchard Fill
28
-
Contains Coppice Or Osiers
-
Coppice Or Osiers Fill
29
-
Contains Scrub
-
Scrub Fill
30
-
Contains Boulders
-
Boulders Fill
31
-
Contains Rock
-
Rock Fill
32
-
Contains Scree
-
Scree Fill
33
-
Contains Rough Grassland
-
Rough Grassland Fill
34
-
Contains Heath
-
Heath Fill
35
-
Contains Marsh
-
Marsh Fill
36
Unclassified
99
Contains ‘General Feature’
Is NULL
-
Obstructing
Default Line
1
Contains ‘Building’
Outline
Manmade
Obstructing
Building Outline Line
2
Contains ‘General Feature’
Is NULL
-
Edge / Limit
Edge Line
3
Contains ‘Road Or Track’
Public
Manmade
Edge / Limit
Road Or Track Line
4
Contains ‘Building’
Division
Manmade
Obstructing
Building Division Line
5
-
Polygon Closing Link
-
-
Polygon Closing Line
6
Contains ‘Inland Water’
Is NULL
-
Edge / Limit
Inland Water Line
7
-
Inferred Property Closing Link
-
-
Property Closing Line
8
Contains ‘General Surface’
Is NULL
Natural
Edge / Limit
General Surface Natural Line
9
Contains ‘Building’
Outline
Manmade
Overhead
Building Overhead Line
10
-
Bottom Of Slope
Bottom Of Slope Line
11
-
Top Of Slope
-
-
Top Of Slope Line
12
-
Step
-
-
Step Line
13
-
Unmade Path Alignment
-
-
Path Line
14
-
Mean High Water (Springs)
-
-
Mean High Water Line
15
-
Traffic Calming
-
-
Traffic Calming Line
16
-
Standard Gauge Track
-
-
Standard Gauge Track Line
17
-
Bottom Of Cliff
-
-
Bottom Of Cliff Line
18
-
Top Of Cliff
-
-
Top Of Cliff Line
19
-
Mean Low Water (Springs)
-
-
Mean Low Water Line
20
-
Overhead Construction
-
-
Overhead Construction Line
21
-
Culvert
-
-
Culvert Line
22
-
Pylon
-
-
Pylon Line
23
Landform
-
Natural
-
Landform Natural Line
24
Unclassified
-
-
-
Unclassified Line
99
-
Ridge Or Rock Line
-
-
Ridge Or Rock Line
25
Historic Interest
-
-
-
Historic interest Line
26
-
Narrow Gauge
-
-
Narrow Gauge Line
27
-
Buffer
-
-
Railway Buffer Line
28
-
Tunnel Edge
-
-
Tunnel Edge Line
29
Landform
-
Manmade
-
Landform Manmade Line
30
-
-
-
-
Unclassified
99
-
Spot Height
Spot Height Point
1
-
Emergency Telephone
Emergency Telephone Point
2
-
Site of Heritage
Site Of Heritage Point
3
-
Culvert
Culvert Point
4
-
Positioned Nonconiferous Tree
Positioned Nonconiferous Tree Point
5
Inland Water
-
Inland Water Point
6
Roadside
-
Roadside Point
7
-
Overhead Construction
Overhead Construction Point
8
Rail
-
Rail Point
9
-
Positioned Coniferous Tree
Positioned Coniferous Tree
10
-
Boundary Post Or Stone
Boundary Post Point or Stone Point
11
-
Triangulation Point Or Pillar
Triangulation Point Or Pillar Point
12
Historic Interest
-
Historical Interest Point
13
Landform
Positioned Boulder
Landform Point
14
Tidal Water
-
Tidal Water Point
15
Structure
-
Structure Point
16
10080
-
Positioned Nonconiferous Tree Point
3
10120
-
Inland Water Point
4
10176
-
Inland Water Point
4
10159
-
Inland Water Point
4
Unclassified
99
148 127 807 | 10046 | General Feature | Obstructing | Default Line | 1 |
64 612 785 | 10019 | Building | Outline | Man-made | Obstructing | Building Outline Line | 2 |
29 515 251 | 10046 | General Feature | Edge / Limit | Edge Line | 3 |