DuckDB is an embedded analytical database its CWI Amsterdam authors call "SQLite for analytics": a single `.duckdb` file, columnar storage, a vectorized engine, and the `ST_*` spatial function set via the spatial extension. Our exporter writes the selected OSM area into a `.duckdb` container where each map layer becomes its own table. To set expectations honestly: geometry is stored as WKT TEXT in a `geom_wkt` column rather than a native GEOMETRY type — to get real geometry you simply call `ST_GeomFromText(geom_wkt)` after `LOAD spatial`. Coordinates stay in WGS84 (EPSG:4326); spatial indexes and Hilbert sorting are not created — those are left to you.
主要特点
关于 DuckDB 格式
DuckDB is an analytical database that lives in a single file and needs no server. It is often called the SQLite of analytics: columnar storage and a vectorized engine give fast aggregations and joins over millions of rows right on a laptop, while the spatial extension adds the familiar ST_ functions.
A map is exported to DuckDB when you need SQL but do not want to raise PostgreSQL with PostGIS: a one-off analysis in a notebook, an ETL script, a model in dbt, a prototype query before moving it into a big warehouse. The file can simply be handed to a colleague — they will open it with a single command.
The output is a single .duckdb file, where every map layer has become a separate table and OSM attributes have become columns; the export parameters lie in the service table _metadata. The geometry is written as WKT text into the geom_wkt column: that way the file reads even without the spatial extension, and real geometry is obtained by calling ST_GeomFromText after LOAD spatial. The coordinates are WGS84; spatial indexes are not created, that decision is left to you.
打开 DuckDB 文件的程序
以下程序可以打开、编辑和处理从 OSM2CDR 导出的 DuckDB Spatial Database(.duckdb)文件:
格式规格
- 专有格式
- 仅 2D
- 无损(无质量损失)
- 存储要素属性
- 输出:1 个文件
- A single .duckdb file, one table per layer; geometry stored as WKT TEXT in geom_wkt (read via ST_GeomFromText after LOAD spatial), WGS84, no spatial index.
谁在使用 DuckDB 地图
如何导出 DuckDB
导出后如何打开
- DuckDB CLI — run duckdb map.duckdb and look around: SHOW TABLES lists the layers, DESCRIBE lists the columns of a particular table.
- Python — import duckdb, then con.execute("INSTALL spatial; LOAD spatial;") and ordinary queries; the result comes straight into pandas.
- Geometry — wrap the column in ST_GeomFromText(geom_wkt), otherwise it stays text: spatial functions do not work with text.
- Exporting further — COPY (SELECT ...) TO 'out.parquet' or 'out.geojson' converts a selection into another format right from SQL, with no intermediate tools.
- DBeaver — connects to the file as to an ordinary database, if you find a graphical client more convenient.