Returns the Tiny Well-Known Binary (TWKB) representation of one or more geometry objects as a bytea value.
Syntax
bytea ST_AsTWKB(geometry g1, integer decimaldigitsXY, integer decimaldigitsZ, integer decimaldigitsM, boolean includeSizes, boolean includeBoundingBoxes);
bytea ST_AsTWKB(geometry[] geometries, bigint[] uniqueIds, integer decimaldigitsXy, integer decimaldigitsZ, integer decimaldigitsM, boolean includeSizes, boolean includeBoundingBoxes);Parameters
| Parameter | Description |
|---|---|
g1 | The geometry object to convert. |
decimaldigitsXY | The number of decimal places to retain in the x and y coordinates. Default value: 0. |
decimaldigitsZ | The number of decimal places to retain in the z coordinate. Default value: 0. |
decimaldigitsM | The number of decimal places to retain in the m coordinate. Default value: 0. |
includeSizes | Specifies whether to include the size of the geometry object in the output. Default value: false. |
includeBoundingBoxes | Specifies whether to include the bounding box of the geometry object in the output. Default value: false. |
geometries | An array of geometry objects to convert. |
uniqueIds | An array of unique identifiers corresponding to the geometry objects in geometries. |
Examples
Convert a point geometry to its TWKB representation:
SELECT ST_AsTWKB(ST_GeomFromText('POINT(116 40)',4326));
st_astwkb
------------------------
\xa1008082880b80a4e803
(1 row)该文章对您有帮助吗?