Returns the KML representation of an ST_Geometry value.
geometry-expression.ST_AsKML([ format])
Name | Type | Description |
---|---|---|
format |
VARCHAR(128) |
A string defining the parameters to use when converting the geometry-expression to a KML representation. If not specified, the default is 'KML'. |
LONG VARCHAR Returns the KML representation of the geometry-expression.
The ST_AsKML method returns a KML string representing the geometry. A number of different formats are supported (with associated options) and the desired format is selected using the optional format parameter. If the format parameter is not specified, the default is 'KML'.
The format string defines an output format and parameters to the format. The format string has one of the following formats:
format-name |
format-name(parameter1=value1;parameter2=value2;...) |
parameter1=value1;parameter2=value2;... |
The first format specifies the format name and no parameters. All format parameters use their default values. The second format specifies the format name and a list of named parameter values. Parameters that are not supplied use their default values. The last format specifies only parameter values, and the format name defaults to 'KML'.
The following format names may be used:
KML The Keyhole Markup Language format defined by the OGC.
The following format parameters can be specified:
Format Name | Parameter Name | Default Value | Allowed Values | Description |
---|---|---|---|---|
KML | Version | 2 | 2 | KML version 2.2 is supported. |
KML | Attribute | Automatically generated optional attributes | One or more attributes may be specified for the top level geometry element only | Any legal XML attributes may be specified. |
KML | Namespace | none |
|
The namespace parameter specifies the output format convention for namespace. |
KML | SubElement | Automatically generated KML sub elements | One or more sub elements may be specified for the top level geometry element only | Any legal XML elements may be specified. As an example extrude, tessellate and altitudeMode elements may be specified. |
By default, ST_AsKML uses the original format for a geometry, if it is available. Otherwise, the internal format is used. For more information about internal and original formats, see STORAGE FORMAT clause, CREATE SPATIAL REFERENCE SYSTEM statement.
SQL/MM (ISO/IEC 13249-3: 2006) 5.1.39
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() |
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>') |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |