Cell Properties functions in the A5 Geospatial Index DuckDB extension
Function category
Cell Properties
5 functionsInspect a specific cell — its area and average edge length in meters, its resolution level, whether it's a validly-encoded cell, and the polygon vertices that form its boundary. Useful for filtering, validation, and rendering cells on a map.
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
resolution
|
Type
INTEGER
|
Mode Positional | Description |
Description
Returns the area in square meters of an A5 cell at the specified resolution level
SELECT a5_cell_area(10);
Output
| a5_cell_area(10) |
|---|
| 32429099.068923894 |
Related functions
- a5_cell_edge_length_avg() — Returns the average edge length in meters of an A5 cell at the specified resolution level; individual edges vary from the average by roughly +/-10%
- a5_get_resolution() — Returns the resolution level (0-30) of an A5 cell
- a5_get_num_cells() — Returns the total number of A5 cells at the specified resolution level (0-30)
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
resolution
|
Type
INTEGER
|
Mode Positional | Description |
Description
Returns the average edge length in meters of an A5 cell at the specified resolution level; individual edges vary from the average by roughly +/-10%
SELECT a5_cell_edge_length_avg(10);
Output
| a5_cell_edge_length_avg(10) |
|---|
| 4675.881472821423 |
Signature
3 overloaded forms · click to inspectArguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
cell
|
Type
UBIGINT
|
Mode Positional | Description |
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
cell
|
Type
UBIGINT
|
Mode Positional | Description |
Argument
closed_ring
|
Type
BOOLEAN
|
Mode Positional | Description |
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
cell
|
Type
UBIGINT
|
Mode Positional | Description |
Argument
closed_ring
|
Type
BOOLEAN
|
Mode Positional | Description |
Argument
segments
|
Type
INTEGER
|
Mode Positional | Description |
Description
Returns the boundary vertices of an A5 cell as a closed ring of [lon, lat] points
SELECT a5_cell_to_boundary(a5_lonlat_to_cell(-122.4, 37.8, 5));
Output
| a5_cell_to_boundary(a5_lonlat_to_cell(-122.4, 37.8, 5)) |
|---|
| [(-123.91841441068891, 37.07072636323092), (-123.07208493364055, 36.93440251226853), (-122.23003392974135, 36.79239099498031), (-121.39776711864215, 36.97396218211518), (-120.5617228138475, 37.150588175283566), (-120.90288444799262, 37.727609112987), (-121.24914021841249, 38.30267874469804), (-122.1294038096313, 38.231723424706054), (-123.00840835218185, 38.15508109275352), (-123.46729324681684, 37.61361779528323), (-123.91841441068891, 37.07072636323092)] |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
cell
|
Type
UBIGINT
|
Mode Positional | Description |
Description
Returns the resolution level (0-30) of an A5 cell
SELECT a5_get_resolution(a5_lonlat_to_cell(-122.4, 37.8, 10));
Output
| a5_get_resolution(a5_lonlat_to_cell(-122.4, 37.8, 10)) |
|---|
| 10 |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
cell
|
Type
UBIGINT
|
Mode Positional | Description |
Description
Returns true if the value is a valid A5 cell ID (a canonically-encoded cell). The world cell (0) is considered valid
SELECT a5_is_valid_cell(a5_lonlat_to_cell(-122.4, 37.8, 5));
Output
| a5_is_valid_cell(a5_lonlat_to_cell(-122.4, 37.8, 5)) |
|---|
| true |