Fast OSM API /map call implementation in pure SQL.
This /map call takes 22 seconds to complete on osm.org. Current cgimap implementation needs ~2 network round trips between database and application, effectively limiting API speed to ~2000 objects per second.
Details in Operations ticket: openstreetmap/operations#135
# set up your Postgres environment
export PGUSER=gis PGDATABASE=gis
# import data to your postgres
zcat minsk.sqld.gz | psql
# change something
vim fastmap.sql
# re-export reference data and explain
make
# observe changes you've made
git diff
To have a look at schema, there is SVG on wiki:
We believe there is postgres database gis
, user gis
, accepting trust connections on localhost.
# grab software
sudo apt install osmosis curl wget unzip
# import schema
curl https://raw.githubusercontent.com/openstreetmap/openstreetmap-website/master/db/structure.sql | psql
# get latest osmosis wit non-broken pbf support
wget http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-latest.zip
unzip osmosis-latest.zip
# grab osm dump of Belarus
wget http://data.gis-lab.info/osm_dump/dump/latest/BY.osm.pbf
# import
bin/osmosis --read-pbf file="BY.osm.pbf" --log-progress --write-apidb database="gis" user="gis" host="localhost" validateSchemaVersion=no