Loading GML data into a GIS
Last updated
Last updated
Geography Markup Language (GML) is an XML dialect, which can be used to model geographic features. It was designed by the Open Geospatial Consortium (OGC) as a means for people to share information regardless of the particular applications or technology that they use. In the first instance, GML was used to overcome the differences between different geographic information system (GIS) applications by providing a neutral file format as an alternative to proprietary formats.
The data can be loaded into several GIS. This section describes how to translate the GML and load it into some commonly used GIS. For more information about other GIS that OS MasterMap Water Network Layer is compatible with, please speak to your Relationship Manager.
The common software covered in this section are as follows:
QGIS
FME
ERSI ArcMap
MapInfo Professional
Cadcorp Map Modeller
The following step-by-step instructions outline how to load OS MasterMap Water Network Layer into QGIS using the GML file(s) you have received. They have been prepared using version 3.16.7 of QGIS Desktop – an open-source GIS in which you can create, edit and visualise and publish geographic information. You can download QGIS for free from the 'Download QGIS for your platform' page of the QGIS website.
Launch QGIS.
OS MasterMap Water Network Layer data can be loaded into QGIS either zipped or unzipped. To load the data, click on Add Vector Layer button from the left-hand toolbar.
The Data Source Manager dialog box will open. In the Source section, click on the […] button to the right of the Vector Dataset(s) field and navigate to the GZ or GML file you wish to import.
When you've selected the file you wish to import, click Add.
Alternatively, you can load the file by dragging and dropping the GZ or GML file into a blank canvas.
This will open a Select Vector Layers to Add… dialog box in which you can select the layer(s) you wish to add to the GIS. If you wish to add both water layers (i.e. HydroNode and WatercourseLink), click Select All. Confirm your choice by clicking OK:
The HydroNode and WatercourseLink layers will be added to the canvas in the main map window.
You can add additional layers of OS MasterMap (for example, OS MasterMap Topography Layer) to give context to OS MasterMap Water Network Layer data.
You can also use QGIS to export OS MasterMap Water Network Layer data into many different common GIS formats. This will allow you to open the files in many other GIS applications.
Right-click on the layer you want to translate, then select Export and Save Feature As…
Note: If you are trying to save layers for more tiles or a national dataset, you will have to save them separately as there is no option for grouping layers.
In the Save Vector Layer as… dialog box that opens, use the dropdown arrow in the Format field to select your chosen format for further analysis, for example, MapInfo TAB or ESRI Shapefile.
Click on the Browse button to save your file to a location of your choice.
Click OK to save the data in your chosen format.
The following section details how to load OS MasterMap Water Network Layer into FME using the GML file you have received. Doing so will allow you to view the data and then translate it into the most appropriate format for your software. The step-by-step instructions have been prepared using FME 2019.1.
Open FME Workbench and select New in the Getting Started box.
Click the Add Reader button from the main toolbar to add a Reader.
In the Add Reader dialog box that opens, select GML (Geography Markup Language) from the dropdown list for Format.
Use the Browse […] button next to the Dataset field to navigate to your files and select them.
Leave the Parameters… as default and the Workflow Options as Individual Feature Types.
Select OK to add the Reader.
Once the Reader has been added successfully, the log window will display the text 'Mapping File Generation was SUCCESSFUL' and the Select Feature Types dialog box will open.
Note:
If FME cannot find the appropriate schema file for use in translation, the OS MasterMap Water Network Layer XML schema v1 file can be downloaded from the schema repository on the OS website.
In the Select Feature Types dialog box, select the feature types that you wish to translate from the list or use the Select All option to add all objects.
Note: OS MasterMap Water Network Layer currently only contains the feature types of WatercourseLink and HydroNode. FME will give you additional feature type options inherited from INSPIRE.
Click OK.
OS MasterMap Water Network Layer objects will have been added to the canvas.
Before translating the data, FME allows you to view the data. The viewing process is faster than translation and allows you to quickly interrogate the data before you start translating it.
Highlight all of the feature types you wish to view by either selecting them individually or drawing a box around them.
Right-click on one of the feature types and select Connect Inspectors.
Run the workspace (click the Run button on the main toolbar) with the Inspectors connected in order to view the data in FME Data Inspector.
When finished, the two layers of OS MasterMap Water Network Layer will be viewable in the Visual Preview window. You can open this window in a separate FME Data Inspector window by clicking the FME Data Inspector button.
You can use FME to translate the files from GML to any other format supported by FME (for example, TAB, SHP, GPKG or a spatial database).
In the main FME window, remove the Inspectors you have connected if you have chosen to use FME Data Inspector to view and interrogate the data. You can do this by clicking and deleting each Inspector separately or by selecting all of them and deleting them together.
Click on the Add Writer button from the main toolbar.
In the Add Writer dialog box that opens, select the format you are translating into from the dropdown list for Format, for example, OGC GeoPackage or File GeoDatabase.
Use the Browse […] button next to the Dataset field to navigate to the folder where you want to save the translated data.
Leave the Parameters… set to default.
Under the Add Feature Type(s) section, set Table Definition to Copy from Reader. This will enable the new Writer to inherit the schema of the Reader feature types.
Click OK to add the Writer.
A Select Feature Type dialog box will appear prompting you to select which existing feature type(s) to copy. Select both the WatercourseLink and HydroNode feature types, then click OK.
The Writer feature types will now be added to the canvas. The new Writer feature types will have inherited the schema of the Reader feature types.
Connect the Readers to the Writers by dragging the triangle on the Reader and connecting it to the red triangle on the corresponding Writer.
Once the workspace has been set up, run the translation by clicking the Run Translation button.
Note: This is a basic translation of the data, and within FME workbench you could manipulate the data further if needed. However, you can use the software just as a translator and open the data in other GIS software for analysis.
The following step-by-step instructions outline how to load OS MasterMap Water Network Layer GML data into ESRI ArcMap. The instructions were prepared using ESRI ArcMap version 10.6.1.
GML data can be now imported as zipped GML (GZ) directly into ESRI ArcMap using the Data Interoperability extension called Quick Import. The Data Interoperability extension is now available at no cost as a part of ArcMap from version 10.2. You will require Internet access when using the Quick Import tool so that the data can access the schema attached to the file.
Note:
If your version of ArcMap is older than 10.2 and you do not have a licence for Data Interoperability, you will have to use translation tools available in QGIS or FME to first translate the GML data into ESRI shapefiles, before you can load them in ArcMap.
You can find more information about Quick Import on the ArcGIS Data Interoperability page of the ESRI website.
Launch ArcMap.
Click on the ArcToolbox window button in the main toolbar.
In the ArcToolbox window that opens, click on the plus sign next to Data Interoperability Tools, then double-click on Quick Import.
In the Quick Import dialog box that opens, click on the […] button next to the Input Dataset field.
In the Specify Data Source dialog box that opens, click on the dropdown arrow in the Format field and select More Formats.
In the FME Reader Gallery dialog box that opens, select GML SF-0 (Geography Markup Language Simple Features Level SF-0 Profile) from the list of options, then click OK.
Back in the Specify Data Source dialog box, use the […] button next to the Dataset field to navigate to the folder where you saved your GZ file; select the folder and click Open. Make sure that extensions available to load are *.gz / *.gml.
Leave the rest of the settings as default and click OK.
Back in the Quick Import dialog box, click on the folder button to the right of the Output Staging Geodatabase field.
In the Output Staging Geodatabase dialog box that opens, navigate to the correct folder and select the output geodatabase for the feature classes to be stored in.
Select Geodatabases from the dropdown options for Save as type.
Click Save.
Once you have made your selections for the Input Dataset and Output Staging Geodatabase fields, you can click OK at the bottom of the Quick Import dialog box.
As soon as the import process has started, you will see a process running notification at the bottom of your screen. When the import process has successfully completed, the following popup window should appear in the bottom right-hand corner of your screen:
If your version of ArcMap is older than version 10 or if you do not have access to the Quick Import (Data Interoperability) extension, you will have to use the translation tools available in QGIS or FME to translate the GML data into ESRI shapefiles first, before you can load them into ArcMap.
Note: The following instructions were prepared using ESRI ArcMap version 10.6.1.
Launch ArcMap.
To load a shapefile into ArcMap, click on the Add Data button in the main toolbar.
In the Add Data dialog box that opens, click the Connect To Folder button.
In the Connect To Folder dialog box, navigate to the folder where you saved your translated OS MasterMap Water Network Layer data, then click OK.
Back in the Add Data dialog box, select the WatercourseLink and HydroNode shapefiles that will now be in the list of options, then click Add.
AThe two OS MasterMap Water Network Layer features should now have loaded into the map window of ArcMap.
The following instructions outline how to load OS MasterMap Water Network Layer GML into MapInfo Professional. They have been prepared using version 12.5 of MapInfo. This new version of MapInfo allows you to convert GML data using a tool called Universal Translator.
Note: These instructions refer to the 64-bit version. The Universal Translator window is the same in the 32-bit version; however, the MapInfo menus are slightly different.
If your version of MapInfo is 12.0.2 or older, you will have to use translation tools available in FME or QGIS to translate the GML data into MapInfo TAB before you can load the data into MapInfo.
Open MapInfo Professional.
On the main toolbar, select Tools > Universal Translator > Universal Translator.
In the FME Quick Translator dialog box that opens, select File > Translate or click on the Translate data button.
The Set Translation Parameters dialog box will open. In the Reader section, click on the dropdown button next to Format.
The Reader Gallery dialog box will open. Select GML (Geography Markup Language) from the list of options, then click OK.
In the Reader section within the Set Translation Parameters dialog box, navigate to the folder where you saved your GML files under the Dataset option. A Select 'File' dialog box will appear. Once you've located the folder and selected it, click OK.
In the Writer section within the Set Translation Parameters dialog box, click on the dropdown button next to Format and select MapInfo TAB.
Again in the Writer section, within the Dataset option, navigate to the folder where you want your TAB file to be saved.
You can leave the rest of the settings as default.
Click OK.
The translation will start. You will notice commands appearing in the FME Quick Translator dialog box.
When the translation has completed, you will see a line of text saying: ‘Translation was SUCCESSFUL’. Close the FME Quick Translator dialog box.
The GML files will have been successfully translated into MapInfo TAB files.
Open MapInfo Professional.
To load translated files, select Home > Open on the main toolbar.
The Open dialog box will open. In the Look in option, navigate to the folder where you saved your TAB files.
If you don’t see your files, select MapInfo (*.tab) from the Files of type dropdown menu.
Select WatercourseLink and HydroNode, then click Open.
The data will now load into MapInfo.
To add the Layers window, right-click in the main window and select Layer Control. This will display the two OS MasterMap Water Network Layer objects that you have loaded: WatercourseLink and HydroNode.
The following instructions outline how to load OS MasterMap Water Network Layer GML into Cadcorp SIS Map Modeller. They have been prepared using Cadcorp SIS Map Modeller version 8.0 (x64).
Launch Cadcorp SIS Map Modeller.
Select the Home tab on main menu toolbar, then click the Add Overlay button.
In the Overlay Types dialog box that opens, select Files > File > Next.
This will open the File Browser dialog box. Navigate to the folder you have saved the GML data in.
In the bottom right-hand corner of the File Browser dialog box, change the files from All files (*.*) to Ordnance Survey (GB) MasterMap layer (*.gml, *.gz).
Back in the File Browser dialog box, select the file(s) and click Finish.
OS MasterMap Water Network Layer features will have been added to the main map window.