# KML - Keyhole Markup Language

OGR has limited support for KML writing and no support for reading KML. OGR generates KML 2.0. The KML driver has no coordinate system support at this time.

## Creation Issues

KML is mix of formatting and feature data. When writing KML, attributes are added to the output with the following HTML structure:

    <b>Attribute name</b>: Attribute content

The OGR KML driver supports multiple layers of data. Each input layer is translated into a separate KML "Folder" element.

## Creation Options

The following creation options are supported:

- NameField: Allows you to specify the field to use for the KML <name> element.

      ogr2ogr -f KML output.kml input.shp -dsco NameField=RegionName

## Example

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

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

## See Also

- KML 2.0 Specification
- KML 2.0 Tutorial