Returns the KML representation of an ST_Geometry value.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsKML()
The following example returns the result <Point><coordinates>1,2,3,4</coordinates></Point>.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsKML('KML(Version=2)')
The following returns the result <kml:Point><kml:coordinates>1,2,3,4</kml:coordinates></kml:Point>. The Namespace=global parameter provides a dedicated ("kml") prefix for the given element and its sub elements. This is useful when the query is used within an aggregate operation, such that, some top level element defines the namespace for the "kml" prefix.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsKML('KML(Version=2;Namespace=global)')
The following returns the result <Point><coordinates>1,2,3,4</coordinates></Point>. No namespace information is included in the output.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsKML('KML(Version=2;Namespace=none)')
The following returns the result <Point xmlns="http://www.opengis.net/kml/2.2"><coordinates>1,2,3,4</coordinates></Point>. The default xml namespace is used.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsKML('KML(Version=2;Namespace=default)')
The following returns the result <Point><altitudeMode>absolute</altitudeMode><coordinates>1,2,3,4</coordinates></Point>. An AltitudeMode sub element is included in the output.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsKML('SubElement=<altitudeMode>absolute</altitudeMode>')
SQL/MM (ISO/IEC 13249-3: 2006) 5.1.39