API for querying administrative boundary data from parquet files using DuckDB and Who's On First data.
- Docker and Docker Compose (recommended)
- Or Node.js 22+ (for local development)
Download the latest Who's On First administrative boundary data:
npm run download
This will fetch the parquet file to data/whosonfirst-data-admin.parquet
.
Note: The Who's On First data is available under the licenses described at https://whosonfirst.org/docs/licenses/
- Download the data (see above)
- Build and run:
docker-compose up --build
The API will be available at http://localhost:3000
- Install dependencies:
npm install
- Run in development mode:
npm run dev
- Or build and run:
npm run build
npm start
Run integration tests against production data:
npm run integration-test
This will build the project, start the server, and run a suite of tests verifying API functionality with real parquet data.
GET /reverse?lon={longitude}&lat={latitude}&fields={field_list}
Query parameters:
lon
(required): Longitude (-180 to 180)lat
(required): Latitude (-90 to 90)fields
(optional): Comma-separated list of fields to include in the response (e.g.,id,name,placetype
). Defaults to all fields exceptgeometry
. Use*
to include all fields including geometry.
Examples:
# Basic query (returns all fields except geometry)
curl "http://localhost:3000/reverse?lon=-122.4194&lat=37.7749"
# Return only specific fields
curl "http://localhost:3000/reverse?lon=-122.4194&lat=37.7749&fields=id,name,placetype,lat,lon"
# Return all fields including geometry
curl "http://localhost:3000/reverse?lon=-122.4194&lat=37.7749&fields=*"
Response:
{
"geometries": [
{
"id": "...",
"name": "...",
"placetype": "...",
...
}
]
}
GET /health
Returns:
{
"status": "ok"
}
Environment variables:
PORT
- Server port (default: 3000)PARQUET_PATH
- Path to parquet file (default: data/whosonfirst-data-admin.parquet)