From 13b3c5ebf9bcaba543d96129c5df193e154462e2 Mon Sep 17 00:00:00 2001 From: codesoap Date: Thu, 1 Oct 2020 09:26:05 +0200 Subject: [PATCH] Use Bremen, Germany as example in SETUP_DATABASE --- SETUP_DATABASE.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/SETUP_DATABASE.md b/SETUP_DATABASE.md index 0fe46f3..fa9e08a 100644 --- a/SETUP_DATABASE.md +++ b/SETUP_DATABASE.md @@ -25,18 +25,19 @@ psql -d gis -c 'CREATE EXTENSION postgis;' ``` # Filling the database with osm data -Use one of the following two code blocks to get started. When everything +Use one of the following two code blocks to get started; the examles +in the README file works for `bremen-latest.osm.pbf`. When everything worked out, you can start playing around with bigger `*.pbf` files, -like Sweden, the USA or even the whole planet. You can find those at -[download.geofabrik.de](https://download.geofabrik.de) and +like Sweden, the USA or even the whole planet. You can find those +at [download.geofabrik.de](https://download.geofabrik.de) and [planet.osm.org](https://planet.osm.org). -Azores (nice and small; good for quick testing): +Bremen, Germany (nice and small; good for quick testing): ```bash -wget 'https://download.geofabrik.de/europe/azores-latest.osm.pbf' +wget 'https://download.geofabrik.de/europe/germany/bremen-latest.osm.pbf' -# Takes ~30s; turns the ~10MB *.pbf file into a ~300MB database: -osm2pgsql --create --database gis azores-latest.osm.pbf +# Takes ~40s; turns the ~16.5MB *.pbf file into a ~265MB database: +osm2pgsql --create --database gis bremen-latest.osm.pbf ``` Serbia (a little bigger, but still good for testing on a simple laptop): @@ -61,13 +62,6 @@ ones. Enter these into a PostreSQL shell. Such a shell can be opened with `psql -d gis`. Make sure the PostreSQL server is running (`postgres -d data`). -Finding cinemas in Belgrade: -```sql -SELECT osm_id, name FROM planet_osm_point -WHERE amenity = 'cinema' -AND way && ST_Transform(ST_GeomFromText('POLYGON((20.3 44.9, 20.3 44.7, 20.6 44.7, 20.6 44.9, 20.3 44.9))', 4326), 3857); -``` - Finding bicycle shops with coordinates in a part of Bremen: ```sql SELECT osm_id, name, ST_AsText(ST_Transform(way, 4326)) FROM planet_osm_point @@ -75,4 +69,11 @@ WHERE shop = 'bicycle' AND way && ST_Transform(ST_GeomFromText('POLYGON((8.7968 53.1037, 8.8142 53.1037, 8.8142 53.0834, 8.7968 53.0834, 8.7968 53.1037))', 4326), 3857); ``` +Finding cinemas in Belgrade: +```sql +SELECT osm_id, name FROM planet_osm_point +WHERE amenity = 'cinema' +AND way && ST_Transform(ST_GeomFromText('POLYGON((20.3 44.9, 20.3 44.7, 20.6 44.7, 20.6 44.9, 20.3 44.9))', 4326), 3857); +``` + Schema reference: https://wiki.openstreetmap.org/wiki/Osm2pgsql/schema