Exports public Allmaps data dumps directly from the database.
This tool uses a streaming database cursor and reuses the same conversion functions as the API:
fromDbRow()from@allmaps/api-sharedgenerateFeature()from@allmaps/api-sharedgenerateAnnotation()from@allmaps/annotation
DATABASE_URL: Postgres connection stringDIRECT_DATABASE_URL: direct Postgres connection string, preferred overDATABASE_URLwhen setANNOTATIONS_BASE_URL: base URL for annotation/map links, defaults tohttps://annotations.allmaps.orgDATA_EXPORT_OUTPUT_DIR: output directory, defaults to./dataDATA_EXPORT_BATCH_SIZE: cursor batch size, defaults to500DATA_EXPORT_R2_DESTINATION: rclone destination, defaults tor2:allmaps-files
pnpm --filter @allmaps/data-export run build
pnpm --filter @allmaps/data-export run export
pnpm --filter @allmaps/data-export run export dev
pnpm --filter @allmaps/data-export run export localhost
pnpm --filter @allmaps/data-export run export production
pnpm --filter @allmaps/data-export run pmtilesConfigure the Render service with the monorepo root as the Docker build context, so workspace dependencies are available locally during the image build:
- Root Directory: unset, or repository root
- Dockerfile Path:
tools/data-export/Dockerfile - Docker Context:
.
Passing dev, localhost, or production loads the matching env file from the
repository root:
.env.devfollowed by.env.dev.local.env.localhostfollowed by.env.localhost.local.env.productionfollowed by.env.production.local
Variables are merged in that order, with existing system environment variables used as a fallback for variables not present in the env files.
The current scaffold writes:
maps.jsonmaps.ndjsonmaps.geojsonmaps.geojsonlmaps-flattened.geojsonannotations.jsondomains-counted.jsonfiles.json
For organizations with a supporter or innovator plan, the export also
writes organization-specific dumps to
DATA_EXPORT_OUTPUT_DIR/organizations/<organizationSlug>/ with the same files
except domains-counted.json. Organization-specific directories do not include
PMTiles.
The PMTiles command reads maps-flattened.geojson and writes:
maps.pmtiles
maps.pmtiles contains one vector source layer per map area band. Area is in
square meters. The zoom ranges keep each band available for Explore's visual
fade window. City and local-scale maps are kept through z14 so they can be
overzoomed when Explore is zoomed further in:
| Source layer | Area | Tile zooms |
|---|---|---|
masks_global |
>= 10,000,000,000,000 |
0-6 |
masks_continent |
1,000,000,000,000-10,000,000,000,000 |
2-8 |
masks_country |
10,000,000,000-1,000,000,000,000 |
4-10 |
masks_region |
100,000,000-10,000,000,000 |
6-12 |
masks_city |
1,000,000-100,000,000 |
8-14 |
masks_local |
< 1,000,000 |
10-14 |
Next implementation steps:
- upload completed files to R2