Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This getting started guide provides instructions for using OS MasterMap Greenspace Layer in different software applications. Users with limited technical knowledge will be able to follow this guide.
This Getting Started Guide illustrates how to load OS MasterMap Greenspace Layer into several commonly used Geospatial Information System (GIS) applications. In most cases, instructions are also included on how to style the data after it has been loaded.
OS MasterMap Greenspace Layer can be downloaded from the OS Data Hub. It is available in the following formats:
ESRI shapefile
GML (3.2.1)
GeoPackage
Vector tiles (MBTiles)
The data is supplied in 5 km² tiles, but features are not clipped at tile edges, resulting in what is called ‘hairy’ tiles. All formats contain one element, namely the greenspace site information.
This product is not available via hard media supply.
This getting started guide focuses on using the product in Shapefile and GML format.
PostGIS is the geospatial extension to the free open-source database application PostgreSQL. The PostGIS extension needs to be installed as part of the PostgreSQL install. This guide uses pgAdmin as a platform for managing and querying PostgreSQL databases.
Open ‘PG Admin’ and, using the menu options available, create a new database and a new schema within the database to hold the OS MasterMap Greenspace Layer data. It is recommended that you do not use the ‘public’ schema to hold the data itself.
In the example above, a database called ‘osdata’ has been created along with a schema called ‘greenspace’ into which the data will be loaded.
As the data to be loaded comes in shapefile format, there is an easy to use PostGIS plugin available within PostgreSQL to load shapefile data.
Select ‘plugins’ from the main menu followed by ‘PostGIS Shapefile and DBF Loader’
The next window allows the user firstly to view connection details and then to add files to the database. The first thing to do will be to test connection details. Click on the ‘View connection details’ button.
The resulting box should contain the username and password already entered along with the host name. The database being used to contain the data should already be selected. Click ‘OK’.
If everything is working OK, ‘Connection succeeded’ should appear in the Log Window. Click the ‘Add File’ button.
In the next window, which appears, use the file tree in the ‘Places’ box on the left-hand side to navigate to the folder in which the OS MasterMap Greenspace Layer shapefiles data sits. A list of the files will appear in the main window. It is possible to load one or all of the files into the database. In the example above, all of the shapefiles have been selected. Then, click ‘Open’.
Another window will open listing the selected shapefiles. The Schema and SRID will need to be changed. The schema will need to be changed to the schema in the database into which the data is being loaded (in this case ‘greenspace’). The SRID (or co-ordinate reference system) will need to be changed to 27700, which is the code for British National Grid. This will need to be done for all the shapefiles being loaded. No other element will need to be changed. Once this has been done click ‘Import’.
At the end of the procedure, the log window at the bottom of the PostGIS import/export manager box should indicate that all the shapefiles have loaded successfully. However, one or two of the shapefiles (depending upon the area of the country being loaded) may fail to load because the text encoding needs to be changed from UTF-8 to LATIN1. If this is the case, the user will need to close the plugin and start again selecting just the shapefiles which failed to load previously. The schema and SRID must be changed again and this time, the character encoding will need to be changed. This can be done by clicking the ‘Options’ button.
Change the DBF character encoding to LATIN1 and click ‘OK.
Changing this should allow the import to complete successfully. For information, the shapefiles which are most likely to need this change to be made are either in Wales or Scotland. This is because files in these areas may contain text which has accents which are not part of the UTF-8 character set.
Once the import has been completed, the user can check if the data is loaded properly by refreshing the schema in PGAdmin and opening the ‘Table’ tree. If the data has loaded correctly, there should be the same number of OS MasterMap Greenspace Layer data tables in the schema as the number of shapefiles opened.
The data is now loaded into the PostGIS database and is now ready to be viewed in a GIS application. As QGIS, the open-source GIS, has been developed to work seamlessly with PostGIS, we will open and view the data using that application. However, any GI application which includes support for PostGIS can be used.
In QGIS, click on the ‘Open PostGIS layer’ button on the left-hand side of the window.
If the OS MasterMap Greenspace Layer data has been placed into an existing database, as in this case, the user will simply need to open the connection to that database within QGIS. The greenspace schema should appear in the list of available schemas within that database.
If the database in which the OS MasterMap Greenspace Layer data sits is new, create a new database connection by clicking the ‘New’ button. The following window appears and the information relating to the new database will need to be entered within the appropriate boxes:
Click on the + sign next to the schema to expand the list of tables. Select all the tables within OS MasterMap Greenspace Layer that need to be loaded to QGIS.
Once all have been selected, click ‘Add’.
The OS MasterMap Greenspace Layer data will load into QGIS. The data will need to be ordered and then styled appropriately using personalised style files or the style files available from GitHub published by Ordnance Survey. . It should be noted that there is no need to add a spatial index to the data from PostGIS as those indexes were added automatically during loading data into PostgreSQL.
It’s possible to load multiple 25 km² grid tiles of data into the same schema in PostgreSQL. As the shapefiles have the 5km grid letters as a prefix in the filename, these files will go into separate tables in the schema.
Data can then be viewed across tile edges using QGIS or other GI applications which support PostGIS.
The screenshot above shows the two tiles, TR15NE and TR15NW loaded into QGIS from the greenspace schema. It should be noted that duplicate features will exist across the tile edges as the data is supplied as ‘hairy tiles’ as previously indicated.
As stated in the point above, if using multiple tiles of data in PostGIS, loading them as described, some features will be replicated across tile edges loaded in different tables of the same features, e.g. in the case of TR15NW and TR15NE. If the data is being used for contextual purposes only, this should not be an issue for the user. However, if the data is being used for any kind of analysis involving counts of features, these duplicates will need to be removed to avoid providing inaccurate results.
It is possible to remove these features using SQL commands in PostgreSQL itself.
Firstly, create a merged file containing the area required using the merge shapefile feature in QGIS documented earlier. In this example, we are going to use the merged shapefile for TR15NW and TR15NE that was made previously and then load it into PostgreSQL using the shapefile loader plugin.
In the example above, an additional table, greenspace area, has been added to the greenspace schema in PostgreSQL. Open the SQL window in PostgreSQL and type in the following command;
The command returns the following result:
This shows that the number of features detected is 34 031, in this example. The following command should now be typed into the SQL window:
The above command creates a new table in the schema with all the duplicate features removed. This can be verified by typing in the following command:
It can be seen from running this query that the number of features in the newly created table is less than in the original merged table. This indicates that the duplicate features along the tile edges have been removed. It will now be possible to load the dissolved table into QGIS and carry out the required analysis.
An alternative way to do what has been described above would be to merge the required shapefiles together and de-duplicate using QGIS as described earlier in this document. The user will then have a set of de-duplicated shapefiles which can then be loaded into PostgreSQL/PostGIS and displayed in QGIS using the methods described previously.
It is possible to load the GML supply data into PostgreSQL using sets of SQL commands, as there is no GUI PostGIS loader for GML data. These SQL commands would create the tables, indexes and load the data. As this data is supplied in shapefile format which can be loaded using the PostGIS shapefile loader plugin, the SQL method of loading the GML data will not be described in this guide.
There are two possible ways of loading and displaying the shapefile data in ESRI ArcGIS. The shapefile data can be loaded straight into ArcGIS. However, if more than one 25km² tile is being loaded, the rendering performance can become an issue. The recommended way of loading the data is to use a file geodatabase to house the data. This is the method which will be described in this guide.
Open ArcCatalog. Choose a folder where the file geodatabase is to be created.
Right-click on the folder and in the context menu select ‘New’ and then ‘File Geodatabase’. Give the new file geodatabase a suitable name for ease of reference by highlighting the geodatabase and typing a new name.
Once created, right-click on the file geodatabase, and select ‘Import’ and then ‘Feature Class (multiple)’.
In the next window, browse to the location containing the data you want to import. Because the individual shapefiles begin with the 5 km prefix, it is possible to import more than one OS MasterMap Greenspace Layer tile into the geodatabase as per user requirements.
Click on the button to the right of the blank window under ‘input features’ and navigate to the folder that contains the OS MasterMap Greenspace Layer shapefile data.
Select all the shapefiles that are required and click ‘Add’.
The shapefiles selected will now appear as a list in the import feature class window. The output file geodatabase should default to the one which has been previously selected. Click ‘OK’. The window will close and now ArcCatalog will import the feature classes into the file geodatabase. A dialog box will appear when the process is complete.
If the file geodatabase is now highlighted, a list of the imported feature classes should be visible. In this example, two shapefiles have been imported.
A useful point to note is that loading the shapefiles into a file geodatabase will automatically add spatial indexes to the data in the import process. There is therefore no need to manually add one once the data has been loaded, which would be the case if shapefiles had been loaded into ArcGIS without using the file geodatabase option. As has been previously mentioned, the addition of a spatial index greatly improves rendering performance.
Start ArcMap. Click on the ‘Import Data’ button in the top toolbar.
In the window that appears, navigate to the location of the file geodatabase just created. Select the feature classes that are required and click ‘Add’.
The data will load into ArcMap. Although ArcMap does put the shapefiles into a more logical sequence, the user can move the layers as they wish. The data will, of course, load in as un-styled data. ArcMap will assign a random style to the data.
If loading a larger area of interest, it is recommended that the user merge the shapefiles together before loading into the file geodatabase. This procedure is described later in this guide. Doing this will also mean that the supplied layer files for styling will only need to be applied once to the data and all the styles will work properly.
If, however, the user simply wants to load multiple areas using the file geodatabase option, there is no mandatory requirement to merge shapefiles together.
To add another 25 km² tile of data in ArcMap, that was previously loaded into the file geodatabase created earlier, simply click ‘Add Data’ and repeat the procedure described above for loading the individual layers for the subsequent tile(s). The user may wish to group the layers for each 100 km tile loaded, for example, all the tiles in 100 km grid square ‘TR’, in the table of contents window to avoid confusion.
To do this, select all the layers within the 100 km tile added, right-click, and then select ‘Group’. The additional layers can be styled as before, using a predefined layer file, or manually as required.
The example above shows that all the layers for TR have been loaded into ArcMap from within the file geodatabase. Another advantage of the file geodatabase option in ArcGIS is that, if you want to add another tile of data later, you can simply import the shapefiles into the same file geodatabase using ArcCatalog and then display them in ArcMap.
As has already been stated, OS MasterMap Greenspace Layer is supplied as ‘hairy tiles’ with features which cross a tile edge being supplied in both tiles in which the feature appears. These duplicate features will occur if more than one 25km2 tile is loaded into a file geodatabase. In many instances, the user will not need to remove duplicate features along the tile edges as the features will display perfectly clearly with one duplicate feature overlying the other.
There may, however, be instances where the user wishes to carry out some form of analysis using feature counts contained within the data. In this case, the data will need to have the duplicate features removed.
To remove duplicate features in ArcMap, it is necessary to firstly merge the tiles together before removing the duplicate features. This procedure can take some time, so the user should consider if this is really needed.
Firstly, the tiles need to be merged to create new feature classes within the file geodatabase containing the original data (or to a completely new file geodatabase or shapefile if required).
Using either ArcMap or ArcCatalog, from the main menu, select ‘Geoprocessing’ followed by ‘Merge’. In the next window, select the layers to be merged. In this example, two feature classes: TR15NE and TR15NW, are being merged. All the attribution is being copied into the new feature class, though the user can specify what attributes need to be copied. The user can also specify the output required. This can be a new feature class within a file geodatabase or a shapefile. In this example a new feature class containing the merged data will be created.
Click ‘OK’ when all the feature classes (or shapefiles) to be merged have been selected. It can be seen using this method, several OS MasterMap Greenspace Layer tiles could be merged, although only two are shown in this example. ArcGIS will then merge the files and load the newly created feature class (or a shapefile if that was being used), into the map window. Depending upon the sizes and number of tiles being merged, this could take some time. A dialog box will appear when the process is finished.
In the example shown below, a new feature class within the original file geodatabase used to hold the data, has been created. This new feature class is called ‘TR Merged’ and covers the entire area of the two separate feature classes previously loaded into the geodatabase. This new feature class has been styled using the ESRI stylesheets for OS MasterMap Greenspace Layer available on GitHub.
The ‘Dissolve’ function in ArcGIS will remove the duplicated features along the tile boundaries. This procedure can be carried out in either ArcCatalog or ArcMap. Firstly select ‘Geoprocessing’ and then ‘Dissolve’ from the main menu.
The user will then need to specify which merged file from which duplicate features are to be removed. In this example, we are looking at the TR Merged feature class.
We are going to save the de-duplicated data as a feature class within the original file geodatabase called ‘TR_Dissolved’. All the dissolve fields in the box need to be ticked except the ObjectID field as otherwise the attribution will not be carried over to the new dissolved file. Once complete, the new dissolved feature class will be loaded into ArcMap. This new dissolved feature class will contain no duplicate features. This procedure could also be performed using shapefiles simply loaded into ArcMap without using a file geodatabase.
The new feature class can now be styled as previously described. A count using the attribute table on both the original merged file and the dissolved file will confirm that the dissolved shapefile contains fewer features. The count below shows the merged feature class with duplicates contains 34 031 features.
The count below shows that the dissolved feature class contains 33 869 features.
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 ArcMap, you will need to navigate to ESRI Shapefile Stylesheets > ESRI stylesheets (LYR). There are currently no predefined stylesheets for styling GML in ArcMap.
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.
The GML data can be imported into ArcGIS using the Quick Import function in ArcToolbox. The data will be imported un-styled. Users should also note that due to the large file sizes of some of the 25km2 grid tiles, especially within larger cities, this import may take time to process.
The user will need to specify the type of data being imported (in this case, GML data) and browse to the files where the GML data is stored.
The quick import will create a new file geodatabase into which to import the data. Once the database location and name has been selected, click ‘OK’ in the dialog box as shown below to start the quick import.
Once the quick import function has been completed, the data can be added using the usual ‘Add Data’ button in ArcMap and selecting all the layers from the newly created file geodatabase.
The data will be loaded un-styled as shown in the example below.
The resulting imported data will then appear in the ArcMap window and can then be styled according to user requirements. The user should manually select the column header of the appropriate table within the data on which to base the styling. This is because in the GML imported data, the column header information is not shortened, unlike the shapefile data (see technical specification). Shapefile data is limited to eight characters within the column header. GML imported data is not limited in this way. In the example below, we are matching the column ‘priFunc’ in the ESRI lyr file with the primaryFunction column header in the imported GML data.
The screenshot above shows the GML imported data styled using a predefined ESRI .lyr file.
All current commonly used versions of MapInfo Professional can open ESRI shapefiles without direct translation. However, for ease of use within MapInfo, it is recommended that users use the universal translator within MapInfo to convert the shapefile supply to MapInfo .TAB files prior to loading the data. This will be described in the procedures for loading the data.
In MapInfo Professional, start universal translator from the ‘Tools’ menu.
Select the ‘Translate’ button at the top left-hand side of the dialog box.
In the next dialog, the user will need to select the translation parameters required. These will include the format of the files being translated, the format to which the data is being translated and the location of the data.
In the example below, the two tiles of OS MasterMap Greenspace Layer data, TR15NW and TR15NE have been selected and the MapInfo .TAB data will be stored in a separate folder from the source data to allow easier data management.
Once selected, click ‘OK’. The translation will then run.
A message box will appear when the process is complete. The user will now have a MapInfo .TAB file for the OS MasterMap Greenspace Layer data. This procedure should be repeated for any extra tiles of OS MasterMap Greenspace Layer which are needed.
To load the created MapInfo .TAB files into MapInfo Professional, simply click ‘File – Open’ and navigate to where the files are located. Select the file to be opened. Select ‘New Mapper’ from the drop-down menu and click ‘OK’. A point to note is that MapInfo will open the data un-styled as shown in the screenshot below:
Data loaded into MapInfo Professional, unlike many other GI applications, is better styled at translation stage because the .TAB format used by MapInfo can retain all the styling information applied in the translation process – it does not use separate styling files to apply a style to the data. OS MasterMap Greenspace Layer data at the current time is not supplied in MapInfo .TAB format. Therefore, there is no Ordnance Survey published styling information for use in MapInfo Professional. It is, however, possible to style the data manually in MapInfo and achieve a successful result.
To add a style to a layer which has been loaded, open the layer control window, and then select the ‘Style Override’ box.
OS MasterMap Greenspace Layer data tables contain all the elements of the data within one MapInfo table, as can be seen from the layers listing.
Therefore, to style an element of the OS MasterMap Greenspace Layer data, it will be necessary to use SQL commands to query the original .TAB data, pick out the specific element to style and create a new
.TAB file for that element. This procedure will take some time to carry out for the whole dataset. An example is provided here for guidance, but a better option would be to use a more specialised translation software application to convert and style the data in one procedure.
From the toolbar menu, click ‘Query – Select’.
In the next window, the user will need to type in the parameters to query the data. In this example, we are going to set up a query to select all the private gardens in one of the two tiles that we have loaded. Click on the ‘Assist’ button and another window appears.
The above expression will extract the private gardens from the original .TAB file. Click on ‘Verify’ to check if the expression is correct. Once satisfied, click ‘OK’. Then click ‘OK’ in the next window and the query will run. The user should see something like the following.
This query will now need to be saved into a new table. Select ‘File – Save Query’.
In the next window give the query a name.
We are going to call this TR15NE_Private_Garden.
Click ‘Save’ and then close the query browser window. The user may need to close the query and any other private garden table open firstly by clicking ‘File – Close’ and selecting the open query table. Then, click on ‘File – Open’ and select the new Private Garden .TAB file just created. The user can open the table in a new mapper or add it to the one that is already open. For this example, it will be added to the one already open in MapInfo.
The data will now be loaded. To check to see if the table has been loaded, click on the layers button in MapInfo to display the loaded layers.
The new table has been loaded. It will now be possible to add a style override to the private garden table by clicking on the style override button and bringing up the following window:
Several style options can now be applied to the private gardens. Click ‘OK’ when finished. The style will now be applied to the data.
In this screenshot, the private gardens are now coloured with a green fill. As stated previously, this method is quite laborious, and is not recommended for anything other than styling small areas of data. The best alternative would be to use a specialised software package to translate the data and style it during translation.
In MapInfo, it is possible to merge the elements of two .TAB files together into one new table using the ‘append’ function. This only works for data tables of the same type and will only work for two .TAB files at a time. Please note that the file into which the new data is appended will need to be saved as a new table at the end of the process. This append process should be repeated if more than two .TAB files need to be merged. For OS MasterMap Greenspace Layer data, all the data elements are contained within a single
.TAB file so the append process is simpler than if the data was made up of multiple elements, as with the open version of the product.
It is highly recommended to back up the original OS MasterMap Greenspace Layer data tables before performing any append function, as the options for carrying out this procedure in MapInfo are limited. If multiple areas are required, it would be better to merge the original shapefiles together before translating the data into .TAB format for use in MapInfo Professional. A free open-source package called ‘GeoMerge’ can be used to merge shapefiles. This application is available from:
http://www.vdstech.com/geomerge.aspx
To append .TAB files together, select ‘Table - Append Rows to Table’ from the main menu.
Select the two tables to append together. Click ‘OK’. The data from TR15NE will now be inserted into TR15NW. The user will need to save the table at the end if the appended data is to be retained. Click ‘File – Save Table’ once the append process has completed. Once the table is saved, TR15NW will now contain the data for the whole area. This is verified if the new table is opened in MapInfo:
There are several ways of doing this in MapInfo Professional. One of the ways, using SQL queries, is described in the MapInfo knowledge base article which can be found here:
MapInfo Professional will convert OS MasterMap Greenspace Layer data in .GML supply into un-styled MapInfo .TAB format, using the Universal Translator tool built into MapInfo Professional version 12.5 onwards. As previously described, select ‘Tools – Universal Translator’ from the main menu.
In the next window, click on the ‘Translate Data’ button.
In the next window, select ‘GML (Geography Mark-up Language)’ from the list of format options. Then, select the tiles which need to be translated and a destination folder for the data to be stored. Click ‘OK’ and the translation will begin. A message will appear at the end stating that the translation was successful if all the input parameters have been set correctly.
The data can now be loaded into MapInfo Professional as .TAB format in the normal way. A point to note is that the translation from .GML to .TAB can produce a single OS MasterMap Greenspace Layer table covering the whole area, avoiding the need for appending files.
CadCorp Map Modeller is a commercial GI application which can load a wide variety of data formats. It also comes with a free software viewer application called CadCorp Map Express.
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.
Guidance on how to use this product in GeoPackage and vector tiles formats can be found in the following documents:
For guidance on using the product in GeoPackage format, please see theGetting started with GeoPackage guide.
For guidance on using the product in vector tiles format, please see the .