ST_AsKML

Determine the Keyhole Markup Language (KML) representation of a geometry object.

Syntax

ST_AsKML(geo[, kmlAttributes][, precision]);
geo
The input geometry.

Type: ST_GEOMETRY(ANY)

kmlAttributes
One or more of the following optional KML attributes:
  • <extrude>
  • <tessellate>
  • <altitudeMode>
These attributes are not validated; they are added to the output exactly as they are specified for the function.

Type: VARCHAR(ANY)

precision
The number of decimal places for all coordinates.

Type: INT4

Default: 16

Returns

A value of type VARCHAR(ANY) that contains the KML representation of the input geometry.

Examples

SELECT inza..ST_AsKML(inza..ST_Point(1, 5), 2);

ST_ASKML
----------
<Point><coordinates>1.00,5.00</coordinates></Point> 
(1 row)
SELECT inza..ST_AsKML(inza..ST_Point(1, 5),
            '<extrude>1</extrude><altitudeMode>clampToGround</altitudeMode>, 2');

ST_ASKML
----------
<Point><extrude>1</extrude><altitudeMode>clampToGround</altitudeMode><coordinates>1.00,5.00</coordinates></Point> 
(1 row)