Keyhole Markup Language representation

You can generate a geometry from a Keyhole Markup Language (KML) representation. KML is an XML-based schema for expressing geographic annotation and visualization on online maps and earth browsers.

The following functions generate a geometry from a KML string.

SE_EnvelopeFromKML()
The function creates an ST_Polygon from a KML LatLonBox string.
ST_GeomFromKML()
The function creates an ST_Geometry from a KML fragment.
ST_LineFromKML()
The function creates an ST_LineString from a KML LineString string.
ST_MLineFromKML()
The function creates an ST_MultiLineString from a KML MultiGeometry string.
ST_MPointFromKML()
The function creates an ST_MultiPoint from a KML MultiGeometry and Point combination string.
ST_MPolyFromKML()
The function creates an ST_MultiPolygon from a KML MultiGeometry and Polygon combination string.
ST_PointFromKML()
The function creates an ST_Point from a KML Point string.
ST_PolyFromKML()
The function creates an ST_Polygon from a KML Polygon string.
For most of these functions, the first argument is the KML representation and the second optional argument is the spatial reference identifier to assign to the ST_Geometry. For example, the ST_LineFromKML() function has the following syntax:
ST_LineFromKML(kmlstring lvarchar, SRID integer)

The SE_AsKML() and ST_AsKML() functions convert the geometry value into a GML representation.

The ST_EnvelopeAsKML() function converts an ST_Envelope bounding box into a KML LatLonBox string.