Postpass

From OpenStreetMap Wiki
Jump to navigation Jump to search
Postpass
Author: woodpeck/postpass/graphs/contributors GitHub
License: GNU GPL v3 (free of charge)
Platform: Linux
Status: Active
Version: 0.2 (2025-04-04)
Website: postpass.geofabrik.de
Source code: woodpeck/postpass GitHub
Programming language: Go

A publicly queryable PostGIS database containing the OSM data

Features
Feature Value
Map Display
?
Routing
?
Navigating
?
Tracking
?
Monitoring
?
Editing
?
Rendering
?
Accessibility
?

Postpass is a thin wrapper around a PostGIS/PostgreSQL database with the OpenStreetMap data. You can send queries over the Internet and receive back the results as GeoJSON document.

This is inspired by and a similar concept to Overpass API. Postpass is intended to do approximately the same things that Overpass API does, just based on a PostGIS database.


Quick Start (60 seconds): Interactive UI

Open https://overpass-turbo.eu/ . Delete any text in the text box. Copy and paste the following into the text box, then press “▶ Run”.

{{data:sql,server=https://postpass.geofabrik.de/api/0.2/}}
SELECT osm_id, tags, geom 
FROM postpass_pointpolygon
WHERE tags->>'amenity'='fast_food' 
AND geom && ST_SetSRID(ST_MakeBox2D(ST_MakePoint(8.34,48.97), ST_MakePoint(8.46,49.03)), 4326)


Quick Start (60 seconds): Developers

Run the following command:

curl https://postpass.geofabrik.de/api/0.2/interpreter --data-urlencode "data=
  SELECT osm_id, tags, geom 
  FROM postpass_pointpolygon
  WHERE tags->>'amenity'='fast_food' 
  AND geom && ST_SetSRID(ST_MakeBox2D(ST_MakePoint(8.34,48.97), ST_MakePoint(8.46,49.03)), 4326)
"


Query Language

Postpass uses SQL, a language which is widely used to query databases of all kinds.


Overpass Turbo integration

Overpass turbo has support for Postpass. Put this into the first line:

{{data:sql,server=https://postpass.geofabrik.de/api/0.2/}}

Then put your query below it.

There is a shortcut {{bbox}} which gets replaced with st_setsrid(st_makebox2d(st_makepoint(‹x_min›,‹y_min›), st_makepoint(‹x_max›,‹y_max›)), 4326) where x_min, y_min, x_max, y_max are the corner coordinates of the current map view.

That means if you are looking for features in the map view you can use the shorthand WHERE geom && {{bbox}} .


Ultra integration

Ultra has support for Postpass as well. Add type: postpass to the YAML front matter.

There is a shortcut {{wsen}} which gets replaced with ‹x_min›,‹y_min›‹x_max›,‹y_max› where x_min, y_min, x_max, y_max are the corner coordinates of the current map view.

That means if you are looking for features in the map view you can use the shorthand WHERE geom && ST_MakeEnvelope({{wsen}}, 4326) .


Ultra example

▶ Run on Ultra

---
title: Postpass
description: Query OpenStreetMap using [Postpass](https://github.com/woodpeck/postpass)
options:
  center: [-122.6847, 45.5112]
  zoom: 15
type: postpass
---
SELECT osm_id, osm_type, tags, geom
FROM postpass_point
WHERE tags->>'amenity'='fast_food'
  AND geom && ST_MakeEnvelope({{wsen}},4326)


Technical Background

Refer to the official documentation.

Postpass is powered by a PostGIS database containing all the OSM data. It’s using a read-only access to the database, so only queries reading the data are possible. Requests to modify or delete data are denied.

The database is imported from OSM raw data using Osm2pgsql. It is updated every 5 minutes.

The database schema is described in postpass-ops/SCHEMA.md.

You can send complex queries which need a lot of computation, or which return a lot of data. Requests are sorted into 3 queues: small, medium and large. Before actually executing the query, the computational cost is estimated and the query is assigned to one of the queues. There are limits how many requests can run in parallel for each queue. Large requests may have to wait in the queue, while small, quick requests are allowed to bypass them.


See also