Returns the WKT representation of an ST_Geometry value.
geometry-expression.ST_AsWKT([ format])
Name | Type | Description |
---|---|---|
format |
VARCHAR(128) |
A string defining the output text format to use when converting the geometry-expression to WKT. If not specified, the format string defaults to 'WKT'. |
LONG VARCHAR Returns the WKT representation of the geometry-expression.
The ST_AsWKT method returns a text string representing the geometry. A number of different text formats are supported (with associated options) and the desired format is selected using the optional format parameter.
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 'WKT'.
The following format names may be used:
WKT The Well Known Text format defined by SQL/MM and the OGC.
EWKT The Extended Well Known Text format defined by PostGIS. This format includes the geometry's SRID and it differs from WKT in the way it represents Z and M values.
The following format parameters can be specified:
Format Name | Parameter Name | Default Value | Allowed Values | Description |
---|---|---|---|---|
WKT | Version | 1.2 |
|
The Version parameter controls the version of the WKT specification used. |
By default, ST_AsWKT 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) Vendor extension
The following example returns the result SRID=0;Polygon ((3 3, 8 3, 4 8, 3 3))
.
SELECT Shape.ST_AsWKT( 'EWKT' ) FROM SpatialShapes WHERE ShapeID = 22 |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |