Encoding functions in the GeoSilo DuckDB extension
Function category
Encoding
3 functionsEncode/decode between [`GEOMETRY`](https://duckdb.org/docs/extensions/spatial) and the compact GEOSILO BLOB format, plus header inspection without a full decode. The `GEOSILO` column type drives most of this transparently — these functions are for explicit BLOB pipelines and Arrow IPC interchange.
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
col0
|
Type
BLOB | GEOSILO
2 concrete typesBLOBGEOSILO
|
Mode Positional | Description |
Description
Decode a GEOSILO blob back into a standard GEOMETRY. Most callers don't need to call this directly — the implicit GEOSILO → GEOMETRY cast runs it on demand for any ST_* function that doesn't have a native GEOSILO overload (e.g. ST_Buffer, ST_Union, ST_AsText).
SELECT ST_AsText(
geosilo_decode(geosilo_encode(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0))')))
);
Signature
2 overloaded forms · click to inspectArguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
col0
|
Type
GEOMETRY
|
Mode Positional | Description |
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
col0
|
Type
GEOMETRY
|
Mode Positional | Description |
Argument
col1
|
Type
BIGINT
|
Mode Positional | Description |
Description
Encode a GEOMETRY into the compact GEOSILO format and return a BLOB. With one argument, the integer scale is derived from the geometry's CRS — degrees default to 1e7 (≈1 cm), projected meters to 100 (1 cm). With two arguments, the second explicitly sets the scale.
SELECT geosilo_encode(ST_GeomFromText('POINT(1 2)'));
SELECT geosilo_encode(geom, 100) FROM utm_data;
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
col0
|
Type
GEOSILO | BLOB
2 concrete typesBLOBGEOSILO
|
Mode Positional | Description |
Description
Read a GEOSILO blob's header without decoding the geometry. Returns STRUCT(geometry_type VARCHAR, vertex_type VARCHAR, scale BIGINT). Useful for filtering by geometry type or auditing the integer scale of a stored column before any heavy spatial work.
SELECT geosilo_metadata(silo_blob) AS meta
FROM compact_table
LIMIT 5;
-- {'geometry_type':'POLYGON','vertex_type':'XY','scale':10000000}