# Styling method overview

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.

## Provided resources <a href="#id-2.1-provided-resources" id="id-2.1-provided-resources"></a>

Styling information, SQL scripts, stylesheets and related resources are available from the [Ordnance Survey OSMM-Topography-Layer-stylesheets ](https://github.com/OrdnanceSurvey/OSMM-Topography-Layer-stylesheets)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.

## Methodology <a href="#id-2.2-methodology" id="id-2.2-methodology"></a>

To create the post-processing styling method, we followed these steps:

1. 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.
2. 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.*

3. 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.*

#### Total discrete feature count for Topographic Lines

<table data-full-width="true"><thead><tr><th width="134">Total count</th><th width="136">feature Code</th><th width="207">descriptive Group</th><th width="154">descriptive Term</th><th width="82">make</th><th width="128">physical Presence</th><th width="177">Styling description</th><th>Code</th></tr></thead><tbody><tr><td>148 127 807</td><td>10046</td><td>General Feature</td><td></td><td></td><td>Obstructing</td><td>Default Line</td><td>1</td></tr><tr><td>64 612 785</td><td>10019</td><td>Building</td><td>Outline</td><td>Man-made</td><td>Obstructing</td><td>Building Outline Line</td><td>2</td></tr><tr><td>29 515 251</td><td>10046</td><td>General Feature</td><td></td><td></td><td>Edge / Limit</td><td>Edge Line</td><td>3</td></tr></tbody></table>

4. 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.

The [attribute tables section](https://docs.os.uk/os-downloads/products/maps-and-imagery-portfolio/os-mastermap-topography-layer/os-mastermap-topography-layer-getting-started-with-styling-guide/attribute-tables) contains tables that list the attributes used to create the new style rules for each OS MasterMap Topography Layer type.
