Returns a Geobuf binary string (bytea) that represents a collection of rows.
Syntax
bytea ST_AsGeobuf(anyelement set row);
bytea ST_AsGeobuf(anyelement row , text geomName);Parameters
| Parameter | Description |
|---|---|
row | The rows to encode as Geobuf. Each row must include at least one geometry column. |
geomName | The name of the geometry column in the row data. When NULL, the function uses the first geometry column found. |
Usage notes
No streaming support: ST_AsGeobuf does not support streaming output.
Examples
Convert a point geometry to Geobuf
Converts a POINT geometry at coordinates (116, 40) with SRID 4326 to a Geobuf binary string using the set-based overload.
SELECT ST_AsGeobuf(q)
FROM (SELECT ST_GeomFromText('POINT(116 40)', 4326)) AS q;Output:
st_asgeobuf
----------------------------------
\x1800220b0a090a0708001a03e80150
(1 row)该文章对您有帮助吗?