GML is an abbreviation for "Geography Markup Language." GML uses XML-like text to encode spatial data. It is difficult to interchange because many incompatible forms of GML have emerged. With the emergence of better formats, such as GeoJSON for "open" text format interchange and GPKG for "open" binary interchange, GML is disappearing. Even GML enthusiasts such as the UK's Ordnance Survey now publish downloadable data in either shapefiles or in GML. Choose shapefiles.
There are two main problems with GML: First, GML's design allows so much variation that most implementations of GML to date for saving GIS data have been incompatible with other implementations. Second, in addition to the variability designed into GML, a significant problem with GML is the extreme inefficiency of the format. GML will frequently require files that are over 100 megabytes in size to store GIS data that other formats can save in only six megabytes.
At the present time, the only concrete form of GML in which a significant amount of data is published appears to be GML as used by the UK's Ordnance Survey (OS). The Manifold GML importer therefore aims at Ordnance Survey GML format, for example, as used for OS Open Data products that may be downloaded without charge.
Newer GML files from the OS usually have a .gml extension. Some OS data files, especially older files, have no extension. GML files can occur in both independent and topological polygon forms. Manifold will automatically import either type and will apply any updates specified. Manifold's GML importer supports object versions and will import any metadata as a Manifold comments component.
GML files may contain multiple drawings for separate area, line and point object drawings, as well as drawings for points with text attributes that can be converted into labels. Area drawings will often contain large areas that overlap other areas.
Open Data maps are named using a grid naming scheme, with the grid square identified by two letters as seen in the illustration at right. For example, the Open Data Local file for the NN square is called NN.gml. It covers the grid square just to the north of Glasgow, which is covered by grid square NS.gml.
To reduce the large file sizes typical of GML, the Ordnance Survey has published GML files zipped into .zip format or, with older files, zipped into .gz "zip" format. Unzip into the contained GML format file before importing into Manifold.
To import a GML format file:
Choose File - Import from the main menu.
Navigate to the desired file.
Choose GML Files (*.gml) in the file type combo box if the file does not have a .gml extension
Double-click the file to import it.
New drawings and tables for the contents of the GML file will appear in the Project pane.
Manifold will automatically read and assign the coordinate system from newer OS files, which often use the OSGB 1936 / British National Grid (EPSG:27700) coordinate system. When importing older OS files, which may use deprecated coordinate system nomenclature, the coordinate system may or may not be automatically harvested from the GML. If the coordinate system is not automatically assigned, assigning OSGB 1936 / British National Grid (EPSG:27700) from the EPSG tab or UK British Grid from the Standard tab of the Coordinate System dialog will usually be correct.
We download the opmplc_gml3_nn.zip file from the Ordnance Survey free downloads page for OpenMap. That unzips into a folder called OS OpenMap Local (GML) NN, which in turn contains a subfolder called data that we see below.
In Manifold, we launch File - Import, navigate to the data subfolder, and double-click on the NN.gml file to import it.
The GML imports as many drawings, providing layers that each contain areas, lines or points. In the illustration above we have created a map, dragged and dropped a Bing Streets image server layer into it and then we have dropped the Building Drawing layer into it from the Building folder. The buildings drawing contains areas that show the outlines of building footprints. When zoomed far out they appear to be points.
In the above we have zoomed much further into the view, and we have used Style to color the building areas a green color. We have clicked on the Component pane to see the coordinate system for the Building Drawing has been automatically read from the GML file and has been assigned. The drawing therefore, as expected, lines up very well with the Bing streets layer.
GML, like GeoJSON, KML, and similar formats, can include geometry data for each object that mixes one or more geometry types. Geometry values declared as multi-type but with all parts having the same underlying type, such as all areas, all lines, or all points, will preserve that underlying type. Geometry values declared as multi-type that mix different types are converted as follows:
See the discussion and example in the KML, KMZ Google topic.
A 70 MB GML format file takes about 45 seconds to import into Manifold. However, it can be saved as a .mxb project file requiring only 4.7 MB of space in a few seconds and thereafter loaded almost instantly. After importing GML files, it is a good idea to save the data in more efficient formats, such as Manifold projects.
GML entities can include version information that allows distinguishing between multiple versions of the same object, that is, between objects with same unique ID assigned by the data provider. When Manifold encounters an object that has already been imported, perhaps as the result of processing an update, it compares the versions of the existing object and the new object, determines which object is more recent and uses the more recent object.
A .gml file can contain a complete version of a drawing or, theoretically, it can contain updates to a drawing that represent changes to be made. In fact, a .gml file could contain both an original version as well as subsequent updates. Manifold does not support use of incremental change files.
3D conversions - Geometry values with mixed 2D and 3Dcoordinates in GML, GeoJSON, and TopoJSON are automatically converted to 3D with 2D coordinates padded with zeros.
File - Import
File - Create - New Data Source
Example: An Imageserver Tutorial - An extensive tutorial showing step by step how to add new data sources that are image servers, how to show them as layers in a map, how to create a new drawing that matches the projection of the map and how to trace over what is seen in an image server layer to create an area object in the drawing.
Example: Import GML / OS Open Map Local - Import an Ordnance Survey, UK, vector map in GML format from the OS Open Map - Local series.