postpass-formatter
May 17, 2026 ยท View on GitHub
A Python WSGI script that wraps around a local Postpass instance and converts the output into various formats using the Jinja templating library.
Running it
You can run this standalone on port 8001 with
python3 formatter.py
or you can run it from Apachae mod_wsgi with a line like
WSGIScriptAlias /formatter /path/to/repo/wsgi.py
Using it
Simply send a HTTP POST request with your PostGIS query in the data
parameter (just like you would with plain Postpass), and additionally
specify a format parameter with the desired output format.
Supported formats
geojson: (default if not defined) single GeoJSONFeatureCollection. If each row doesn't have a geometry column, aHTTP 400will be returned.html_table: A table in HTML<table> <thead><th>count</th><th>is_null</th></thead> <tr><td>141183</td><td>false</td></tr> <tr><td>2404499</td><td>true</td></tr> </table>md_table: A table in Markdown| count | is_null | |---------|---------| | 141183 | false | | 2404499 | true |csv: Comma Separated Values"count","is_null" 141183,"false" 2404499,"true"csv_headerless: Comma Separated Values without a header row141183,"false" 2404499,"true"tsv: Tab Seperated Values"count" "is_null" 141183 "false" 2404499 "true"tsv_headerless: TSV without header rowwith_sql_values: SQLVALUESwith the header columns, suitable to copy/paste into aWITHstatement for later usage
This can be used later like:("count", "is_null") AS (VALUES (141183, false), (2404499, true))WITH original_values ("count", "is_null") AS (VALUES (141183, false), (2404499, true)), select * from data join original_values ...