Returns the WKB representation of an ST_Geometry value.
geometry-expression.ST_AsWKB([ format])
Name | Type | Description |
---|---|---|
format |
VARCHAR(128) |
A string defining the WKB format to use when converting the geometry-expression to binary. If not specified, the default is 'WKB'. |
LONG BINARY Returns the WKB representation of the geometry-expression.
The ST_AsWKB method returns a binary string representing the geometry in WKB format. 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 'WKB'.
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 'WKB'.
The following format names may be used:
WKB The Well-Known Binary format defined by SQL/MM and the OGC.
EWKB The Extended Well-Known Binary format defined by PostGIS. This format includes the geometry's SRID and it differs from WKB 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 |
---|---|---|---|---|
WKB | Version | 1.2 |
|
The Version parameter controls the version of the WKB specification used. |
By default, ST_AsWKB 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 0x01b90b0000000000000000f03f000000000000004000000000000008400000000000001040
.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsWKB('endian=little') |
The following returns the result 0x0101000000000000000000f03f0000000000000040
. The Z and M values are omitted because version 1.1 of the OGC specification for WKB does not support these.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsWKB('WKB(Version=1.1;endian=little)') |
The following returns the result 0x01010000e0e6100000000000000000f03f000000000000004000000000000008400000000000001040
.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsWKB('EWKB(endian=little)') |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |