# GML - Geography Markup Language

OGR has limited support for GML reading and writing. Update of existing files is not currently supported. OGR is based on GML 2.0. The reading only works if OGR is built with Xerces linked in. XML validation is disabled by default. GML writing is always supported, even without Xerces.

Currently the GML driver has no coordinate system support at this time.

## Creation Issues

On export all layers are written to a single GML file all in a single feature collection. Each layer's name is used as the element name for objects from that layer. Geometries are always written as the ogr:geometryProperty property on the feature.

The GML writer supports the following creation options:

- XSISCHEMAURI: If provided, this URI will be inserted as the schema location. Note that the schema file isn't actually accessed by OGR, so it is up to the user to ensure it will match the schema of the OGR produced GML data file.

- XSISCHEMA: This can be EXTERNAL, INTERNAL or OFF and defaults to EXTERNAL. This (attempts) to write a BXML compatible GML schema file to a corresponding .xsd file (with the same basename). The generated schema is still experimental. If INTERNAL is used the schema is written within the GML file, but this is even more experimental and almost certainly not valid XML. OFF disables schema generation (and is implicit if XSISCHEMAURI is used).

## Example

The ogr2ogr utility can be used to dump the results of a Oracle query to GML:

    ogr2ogr -f GML output.gml OCI:usr/pwd@db my_feature -where "id = 0"

The ogr2ogr utility can be used to dump the results of a PostGIS query to GML:

    ogr2ogr -f GML output.gml PG:'host=myserver dbname=warmerda' -sql "SELECT pop_1994 from canada where province_name = 'Alberta'"

## See Also

- GML Specifications

- Xerces