GML (Geography Markup Language) is based on XML and was developed by the Open Geospatial Consortium (OGC) to express geographic features.
GML is a geographic modeling language that can also be used for Internet transactions. It encodes geographic content by describing application objects and their properties. This contrasts with KML (Keyhole Markup Language), which describes object visualization and annotation. GML does not usually have presentation information.
GML was developed between 1998 and 2003, has been adopted as a specification by the OGC. It is also an ISO Standard (ISO 19136). GML uses an XML schema, but it was originally based on RDF (Resource Description Framework). This history has resulted in the use of child elements for properties and remote propery references.
GML uses application-specific schemas instead of one static schema. In other words, it functions as a kind of toolkit to build a schema specific for the application at hand. This compares with KML which has only one schema (although a software package may only support specific features). This results in a rich toolkit that can be tailored to the application at hand, but it does mean that one application's GML can probably not be read by a second application. A good enalogy would be XML itself. An XML file produced by one high level application will probably not be readable by a second high level application unless support for the file's schema is explicitly provided.
A GML file will typically refer to multiple namespaces. For example, MPSuperShape produces GML files that refer to the GML namespace and its own mpss namespace. Here is an example:
ERROR [include_code_listing plugin]: File Not Found (/usr/www/users/winwaed/geowebguru/img/2008/sample_gml_mpsupershape.gml)
In contrast, here is an extract from a UK Ordnance Survey Mastermap GML file:
ERROR [include_code_listing plugin]: File Not Found (/usr/www/users/winwaed/geowebguru/img/2008/sample_gml_mastermap.gml)
The Mastermap standard uses the GML namespace with the osgb standard. This allows for the very rich set of map descriptions required for the OS's map data - in contrast to the very simple map description required by MPSupershape to represent MapPoint annotation. Notice also, that the two files use two very different coordinate systems. Mastermap also supports features that change and are updated over time.
GML's primitives provide support for features, geometry, coordinate reference systems, time, dynamic features, map coverage, units of measure, and presentation styling rules. These can be restricted by profiles. For example, the Point Profile supports point geometric data. This is extended by the Simple Features Profile which adds support for 2d and aggregate geometries.
The application-specific nature of GML combined with its richness is both a strength and a weakness. It can result in a very rich and expressive language, as demonstrated by the OS's Mastermap standard. The richness can also result in very large files. Mastermap is typically delivered as compressed files, and even a small area such as an English county can take up multiple DVDs. This is very rich data, but clearly it could not be delivered over the Internet. However, GML intended for Internet delivery could be much reduced in detail and depth. The second problem is the application-specific schema. Whilst KML or SHP files are portable between different applications, this is rarely the case with GML.