This topic describes the ST_AsTWKB function. This function returns the Tiny Well-Known Binary (TWKB) string that represents one or more geometry objects.
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 whose TWKB representation you want to obtain. |
| decimaldigitsXy | The number of decimal places that you want to retain in the x and y coordinates. Default value: 0. |
| decimaldigitsZ | The number of decimal places that you want to retain in the z coordinate. Default value: 0. |
| decimaldigitsM | The number of decimal places that you want to retain in the m coordinate. Default value: 0. |
| includeSizes | Specifies whether to return the size of the geometry object. Default value: false. |
| includeBoundingBoxes | Specifies whether to return the bounding box of the geometry object. Default value: false. |
| geometries | An array that consists of the geometry objects whose TWKB representation you want to obtain. |
| uniqueIds | An array that consists of the unique identifiers of the geometry objects whose TWKB representation you want to obtain. |
Examples
SELECT ST_AsTWKB(ST_GeomFromText('POINT(116 40)',4326));
st_astwkb
------------------------
\xa1008082880b80a4e803
(1 row)