DuckDB geospatial visualization with deck.gl and MapLibre
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.5.5 | 1.5.6 | 2.0.0 | 2.0.1 |
|---|---|---|---|---|
| Linux AMD64 | ||||
| Linux ARM64 | ||||
| macOS AMD64 | ||||
| macOS ARM64 | ||||
| Windows AMD64 | ||||
| Windows ARM64 | ||||
| WebAssembly |
Installing and Loading
INSTALL duckgl FROM community;
LOAD duckgl;
Example
-- Start DuckGL server
SELECT duckgl_start('localhost', 8080);
-- Open http://localhost:8080 in browser
-- Stop server
SELECT duckgl_stop();
About duckgl
DuckGL provides a web-based geospatial visualization interface for DuckDB.
Features
- Interactive map visualization using deck.gl and MapLibre
- GeoJSON layer rendering from spatial tables
- SQL query execution from browser UI
HTML and PDF reports: Export HTML downloads an offline snapshot containing the last successful SQL query, all returned rows, and a north-up SVG geometry overview without base-map tiles. Export PDF opens that report in the browser print dialog; choose Save as PDF. Saved HTML contains no scripts and does not execute SQL.
Map analysis and additional exports: Inspect table columns, choose a geometry column, specify the source CRS for WGS84 conversion, map a spatial SELECT query, and click features to inspect their attributes. Download query results as CSV or JSON, and map data as GeoJSON, SVG, PNG, or interactive HTML. Interactive HTML embeds the data and runs without the DuckGL server, but needs internet access for map libraries and base-map tiles. SVG and PNG are north-up geometry overviews without tiles. Attached database selection and large integer identifiers retain their exact identity.
The host can publish a committed WGS84 view as a read-only GeoJSON snapshot with duckgl_start_layer(0, view_name). It returns an ephemeral loopback port serving GET /api/layer. Call duckgl_stop_layer() on the same connection to close it. The source repository also includes a Python viewport and point-grid API.
The embedded Python API also exposes typed layer filters, viewport geometry, point vector tiles, versioned detail lookup, and exact counts of points within registered polygons.
English project documentation.
Version 0.3.0 adds 20 SQL functions for map coordinates, tiles and tracks. SQL reference and examples.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| duckgl_bounds_center | macro | NULL | NULL | |
| duckgl_bounds_contains | macro | NULL | NULL | |
| duckgl_bounds_geojson | macro | NULL | NULL | |
| duckgl_bounds_intersect | macro | NULL | NULL | |
| duckgl_destination | macro | NULL | NULL | |
| duckgl_distance_km | macro | NULL | NULL | |
| duckgl_initial_bearing | macro | NULL | NULL | |
| duckgl_longitude_delta | macro | NULL | NULL | |
| duckgl_meters_per_pixel | macro | NULL | NULL | |
| duckgl_midpoint | macro | NULL | NULL | |
| duckgl_quadkey_tile | macro | NULL | NULL | |
| duckgl_radius_bounds | macro | NULL | NULL | |
| duckgl_start | scalar | Start the DuckGL map server on the given host and port. | NULL | [duckgl_start('127.0.0.1', 8080)] |
| duckgl_start_layer | scalar | Serve a GeoJSON snapshot of a committed main-schema view on loopback and return the port. Use port 0 for an available port and a WGS84 geometry column named geometry. | NULL | [duckgl_start_layer(0, 'city_layer')] |
| duckgl_stop | scalar | Stop the DuckGL map server and return its status. | NULL | [duckgl_stop()] |
| duckgl_stop_layer | scalar | Stop this connection's GeoJSON layer server and return true if it was running. | NULL | [duckgl_stop_layer()] |
| duckgl_tile_ancestor | macro | NULL | NULL | |
| duckgl_tile_at | macro | NULL | NULL | |
| duckgl_tile_bounds | macro | NULL | NULL | |
| duckgl_tile_children | macro | NULL | NULL | |
| duckgl_tile_neighbors | macro | NULL | NULL | |
| duckgl_tile_quadkey | macro | NULL | NULL | |
| duckgl_track_length_km | macro | NULL | NULL | |
| duckgl_wrap_longitude | macro | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |