ST_AsTWKB

更新时间:
复制 MD 格式

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

ParameterDescription
g1The geometry object to convert.
decimaldigitsXYThe number of decimal places to retain in the x and y coordinates. Default value: 0.
decimaldigitsZThe number of decimal places to retain in the z coordinate. Default value: 0.
decimaldigitsMThe number of decimal places to retain in the m coordinate. Default value: 0.
includeSizesSpecifies whether to include the size of the geometry object in the output. Default value: false.
includeBoundingBoxesSpecifies whether to include the bounding box of the geometry object in the output. Default value: false.
geometriesAn array of geometry objects to convert.
uniqueIdsAn 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)