It is assumed that the user will have already set the default co-ordinate reference system in QGIS to British National Grid (EPSG 27700).
The version of QGIS used in this guide is version 3.16.7. The latest long-term release of the application is 3.22.4 as of March 2022.
Start QGIS and open a new or existing project. In the top ribbon, navigate to Layer > Add Layer > Add Vector Layer.
In the Data Source Manager window, click the ‘…’ button and navigate to the folder in which your Shapefile(s) are saved. Select which files need to be loaded and then click ‘Open’.
In the Data Source Manager window, click ‘Add’ and then ‘Close’. Your data should now appear in the map frame and in the Layers panel. The loaded data will be un-styled and will appear like the image below.
The data will be loaded by tile reference, as shown in the Layers panel. As features are not cut at the tile edges, there will be some duplicate polygons when loading more than one adjacent tile, which will overlay one another. For small volumes of data, this can be managed in QGIS. However, for larger data volumes, it will be more manageable to merge the data into a single file prior to loading.
When working with shapefiles, it is highly recommended that a spatial index be applied to the data, particularly if loading a large or national set of data. This will significantly improve performance when rendering the data.
Right-click the desired layer in the Layers Panel on the left-hand side of the screen and navigate to 'Properties'.
In the Properties window, navigate to the Source tab and click ‘Create Spatial Index’. Once complete a confirmation window will appear. Click ‘Ok’, then click ‘Ok’ in the Properties window. If working with large shapefiles, you should notice a distinct improvement in performance in rendering and panning the data.
You may need to load more than one 25 km² grid square of data to cover your required area. For ease, shapefiles are prefixed with their National Grid 5 km grid square reference, as shown below. It is recommended that you copy the data to be merged to a new ‘merged data’ folder before carrying out the following steps:
In the top ribbon of your QGIS window, navigate to Vector > Data Management Tools > Merge Vector Layer.
In the Merge Vector Layers window, click the ‘…’ button next to Input Layers to select the tiles to be merged.
Click ‘Add Files(s)’. Navigate to the folder in which your shapefiles are saved. Select which files need to be loaded and then click ‘Open’.
Click the blue return arrow to return to the main window. Click the ‘…’ button next to Merged and click ‘Save to File’. Navigate to the folder where you want to store your merged data and name it appropriately, then click ‘Save’.
This window includes the option to set a Destination CRS. Whilst you can select British National Grid (the standard for all OS Data), the tool will automatically detect the CRS from the data. This is more relevant when processing multiple datasets of varying CRS.
In the Merge Vector Layers window, click ‘Run’. Once the process is complete, click ‘Close’. Your merged data should now appear in the map frame and in the Layers panel. The loaded data will be un-styled and will appear like the image below.
As previously stated, OS MasterMap Greenspace Layer data is supplied as ‘hairy tiles’; where features which cross a 25 km² tile edge are supplied in all tiles in which the feature appears. In many cases, you may wish to use the Greenspace data as merged tiles. In this case, duplicate features will overlay each other perfectly.
However, there may be instances where duplicate features need to be removed, such as when carrying out some form of analysis on the features (for example, when calculating area or conducting a feature count). In this case, the duplicate features will need to be removed.
There are several ways within QGIS to achieve this. There are also several plugins for QGIS which can be installed to carry out this function, in particular, one called ‘MMQGIS’. However, methods using these options are not described here.
The ‘Dissolve’ function in QGIS which is part of standard functionality will effectively carry out this procedure. In the example described below, we are going to removed duplicates from the merged data created in the previous section.
In the top ribbon of your QGIS window, navigate to Vector > Geoprocessing Tools > Dissolve.
In the Dissolve window, under Input Layer, select the data you wish to remove duplicates from. In this case, the merged data is already selected as it is the only vector layer in the workspace.
Click the ‘…’ button next to Dissolve field(s). In the new dialog, select ‘toid’ as the dissolve field. This is the field that will be used to search for and dissolve duplicate features.
Click the blue return arrow to return to the main window. Click the ‘…’ button next to Dissolved and click ‘Save to File’. Navigate to the folder where you want to store your dissolved data and name it appropriately, then click ‘Save’.
In the Dissolve window, click ‘Run’. Once the process is complete, click ‘Close’. Your dissolved data should now appear in the map frame and in the Layers panel. The loaded data will be un-styled and will appear like the image below.
As with the original merged data, it is highly recommended that the de-duplicated file be given a spatial index using the method previously described to improve rendering performance.
In comparison with the data which contains duplicates, the ‘dissolved’ data should contain fewer features. This can be confirmed by either running a COUNT query in an expression window or by simply opening the attribute table of the data and comparing the number of features.
For both the original and dissolved layers, right-click the desired layer in the Layers Panel on the left-hand side of the screen and navigate to Open Attribute Table.
At the top of each attribute table will be a total count of features. The original merged dataset (top) contains 134 753 features, whilst the dissolved dataset (bottom) contains 134 050; confirming that duplicate features have been removed.
Start QGIS and open a new or existing project. In the top ribbon, navigate to Layer > Add Layer > Add Vector Layer.
In the Data Source Manager window, click the ‘…’ button and navigate to the folder in which your GML file(s) are saved. Select which files need to be loaded and then click ‘Open’.
In the Data Source Manager window, click ‘Add’ and then ‘Close’. Your data should now appear in the map frame and in the Layers panel. The loaded data will be un-styled and will appear like the image below.
The data can now be styled using a predefined style file (.QML file) as described previously or using the tools within QGIS. Please note that style files created for shapefile supplies of the data will not work with GML supplies without modifications. It is highly recommended that style files created specifically for the GML supply be used.
It should be noted that rendering performance of the data within QGIS will be much poorer than in the case of the shapefile format, as GML data cannot be spatially indexed. It should also be noted that multiple 25 km² tiles of OS MasterMap Greenspace Layer GML data cannot be merged easily, as with the shapefile option. Consequently, rendering performance will also be much slower.
In addition, it is not easy to de-duplicate features along tile edges using common spatial geoprocessing tools within QGIS. As a result, the GML data itself will have to be queried using code scripts to highlight and remove duplicate features within a text editor. Another approach would be to convert the GML data to shapefiles.
To do this in QGIS, right-click the desired layer in the Layers Panel on the left-hand side of the screen and navigate to Export > Save Features As.
In the next window, select the format to be ESRI shapefile. Click the ‘…’ button next to File Name and navigate to the folder where you want to store your exported data and name it appropriately, then click ‘Save’.
Click ‘OK’. A shapefile will now have been produced from the exported GML file. The shapefile can then be used in the merging and dissolving processes as described previously.
Predefined stylesheets for OS MasterMap Greenspace Layer are available to download from the Ordnance Survey GitHub page below:
Click the 'Code' drop-down button and then click 'Download ZIP'.
To style your OS MasterMap Greenspace Layer data, first download the zip file from the above GitHub repository, then extract and save the extracted files to your preferred location. When styling ESRI shapefiles in QGIS, you will need to navigate to ESRI Shapefile Stylesheets > QGIS stylesheets (QML). When styling GML in QGIS, you will need to navigate to GML Stylesheets > QGIS stylesheets (QML).
Inside the respective subfolders for each stylesheet type, is a ‘Quick Start Guide’ that can be followed to style your OS MasterMap Greenspace Layer data.