Skip to content

Encoding functions in the GeoSilo DuckDB extension

Function category

Encoding

3 functions

Encode/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.

geosilo_decode

Scalar function Encoding
Signature
geosilo_decode(col0: BLOB | GEOSILO) GEOMETRY
Arguments (Positional)
Argument col0 Type BLOB | GEOSILO
2 concrete types
BLOBGEOSILO
Mode Positional Description
Description
1 Round-trip a polygon through the encoding
SELECT ST_AsText(
  geosilo_decode(geosilo_encode(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0))')))
);

geosilo_encode

Scalar function Encoding
Signature
2 overloaded forms · click to inspect
Arguments (Positional)
Argument col0 Type GEOMETRY Mode Positional Description
Description
1 Default scale (auto from CRS, or `1e7` if absent)
SELECT geosilo_encode(ST_GeomFromText('POINT(1 2)'));
2 Explicit scale — UTM / Web Mercator data, 1 cm precision
SELECT geosilo_encode(geom, 100) FROM utm_data;

geosilo_metadata

Scalar function Encoding
Signature
geosilo_metadata(col0: GEOSILO | BLOB) STRUCT(geometry_type VARCHAR, vertex_type VARCHAR, scale BIGINT)
Arguments (Positional)
Argument col0 Type GEOSILO | BLOB
2 concrete types
BLOBGEOSILO
Mode Positional Description
Description
1 Inspect the header of stored silo blobs
SELECT geosilo_metadata(silo_blob) AS meta
FROM compact_table
LIMIT 5;
-- {'geometry_type':'POLYGON','vertex_type':'XY','scale':10000000}