Skip to content

Commit f0b9e3b

Browse files
committed
Add new "explore" theme with some initial topics
OpenStreetMap contains an insane amount of complex data. If you want to use some of that data a first step is often to explore what's there, filter out the stuff that looks interesting, creating some experimental maps, figuring out what's useable and how. The topics in this theme are meant as starting points for such an exploration. They are intended to be used with a tool such as QGIS to quickly display what's there in different ways. Initial topics are "coastline", "postcode", and "restrictions".
1 parent 2b5ef44 commit f0b9e3b

File tree

12 files changed

+1003
-0
lines changed

12 files changed

+1003
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ These are some experimental layers. Use at your own risk.
135135

136136
[More...](themes/experimental/README.md)
137137

138+
### Theme `explore`
139+
140+
OpenStreetMap contains an insane amount of complex data. If you want to use
141+
some of that data a first step is often to explore what's there, filter out the
142+
stuff that looks interesting, create some experimental maps, figure out what's
143+
useable and how. The topics in this theme are meant as starting points for such
144+
an exploration. They are intended to be used with a tool such as QGIS to
145+
quickly display what's there in different ways. QGIS project files are provided
146+
as a starting point.
147+
148+
[More...](themes/explore/README.md)
149+
138150
### Theme `external`
139151

140152
This theme contains some layers not generated directly from OSM data but

config/explore_coastline.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- ---------------------------------------------------------------------------
2+
--
3+
-- Example config for exploring OSM data
4+
--
5+
-- Configuration for the osm2pgsql Themepark framework
6+
--
7+
-- ---------------------------------------------------------------------------
8+
9+
local themepark = require('themepark')
10+
11+
-- For debug mode set this or the environment variable THEMEPARK_DEBUG.
12+
themepark.debug = true
13+
14+
-- ---------------------------------------------------------------------------
15+
16+
themepark:set_option('debug', 'debug') -- Add JSONB column `debug` with debug infos in debug mode
17+
themepark:set_option('tags', 'all_tags') -- Add JSONB column `tags` with original OSM tags in debug mode
18+
19+
-- ---------------------------------------------------------------------------
20+
21+
themepark:add_topic('explore/coastline')
22+
23+
-- ---------------------------------------------------------------------------

config/explore_postcodes.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- ---------------------------------------------------------------------------
2+
--
3+
-- Example config for exploring OSM data
4+
--
5+
-- Configuration for the osm2pgsql Themepark framework
6+
--
7+
-- ---------------------------------------------------------------------------
8+
9+
local themepark = require('themepark')
10+
11+
-- For debug mode set this or the environment variable THEMEPARK_DEBUG.
12+
themepark.debug = true
13+
14+
-- ---------------------------------------------------------------------------
15+
16+
themepark:set_option('debug', 'debug') -- Add JSONB column `debug` with debug infos in debug mode
17+
themepark:set_option('tags', 'all_tags') -- Add JSONB column `tags` with original OSM tags in debug mode
18+
19+
-- ---------------------------------------------------------------------------
20+
21+
themepark:add_topic('explore/postcodes')
22+
23+
-- ---------------------------------------------------------------------------

config/explore_restrictions.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- ---------------------------------------------------------------------------
2+
--
3+
-- Example config for exploring OSM data
4+
--
5+
-- Configuration for the osm2pgsql Themepark framework
6+
--
7+
-- ---------------------------------------------------------------------------
8+
9+
local themepark = require('themepark')
10+
11+
-- For debug mode set this or the environment variable THEMEPARK_DEBUG.
12+
themepark.debug = true
13+
14+
-- ---------------------------------------------------------------------------
15+
16+
themepark:set_option('debug', 'debug') -- Add JSONB column `debug` with debug infos in debug mode
17+
themepark:set_option('tags', 'all_tags') -- Add JSONB column `tags` with original OSM tags in debug mode
18+
19+
-- ---------------------------------------------------------------------------
20+
21+
themepark:add_topic('explore/restrictions')
22+
23+
-- ---------------------------------------------------------------------------

themes/explore/README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
2+
# Theme `explore`
3+
4+
OpenStreetMap contains an insane amount of complex data. If you want to use
5+
some of that data a first step is often to explore what's there, filter out the
6+
stuff that looks interesting, create some experimental maps, figure out what's
7+
useable and how. The topics in this theme are meant as starting points for such
8+
an exploration, they are intended for advanced OSM users.
9+
10+
The data generated is intended to be used with an interactive tool such as QGIS
11+
to quickly display what's there in different ways.
12+
13+
Some of these topics import quite a lot of data and do extensive
14+
post-processing, try with a smaller extract before you run them on the planet
15+
file.
16+
17+
For some details on the contents of the generated database see the source
18+
code of the config file.
19+
20+
## Naming
21+
22+
All table names have the respective topic as prefix.
23+
24+
## Updates
25+
26+
Topics are mostly written in a way to allow updates of OSM data. But updates
27+
might take a while, so minutely updates are not possible for all of then.
28+
This should be improved upon.
29+
30+
## Postprocessing
31+
32+
Use `osm2pgsql-gen` with the respective config file to run SQL commands that do
33+
some postprocessing on the imported data. Without that some tables and/or
34+
columns will not be filled with data.
35+
36+
## Optional Pre-Filtering
37+
38+
For some topics it can make sense to pre-filter the OSM data, so that
39+
processing with osm2pgsql is faster. This is entirely optional. Each topic will
40+
show a command line using [Osmium](https://osmcode.org/osmium-tool/) that does
41+
this pre-filtering.
42+
43+
## QGIS Config
44+
45+
The `qgis` directory contains QGIS config files for each of the themes. They
46+
all use the [database
47+
service](https://www.postgresql.org/docs/current/libpq-pgservice.html)
48+
`explore`. Create a file `.pg_service.conf` in your home directory (if it is
49+
not already there) and add an entry like this:
50+
51+
```
52+
[explore]
53+
host=localhost
54+
port=5432
55+
dbname=explore
56+
user=USERNAME
57+
password=PASSWORD
58+
```
59+
60+
## Topic: Coastline
61+
62+
Explore coastline tagging. Everything tagged `natural=coastline`.
63+
64+
Coastline ways are shown, with details if zoomed in. Pseudo-coastlines along
65+
the 180° meridian and the South Pole that have special tagging are also shown.
66+
Coastlines can only be tagged on ways. Nodes and relations with tag
67+
`natural=coastline` are shown as errors. Coastline (self-)intersections and
68+
open ends are shown as errors as well.
69+
70+
Pre-Filtering:
71+
72+
```
73+
osmium tags-filter -o coastline.osm.pbf DATA.osm.pbf \
74+
natural=coastline
75+
```
76+
77+
## Topic: Postcodes
78+
79+
Explore postcodes in OSM, on POIs, buildings, and from postcode boundaries.
80+
81+
Also generates postcode areas from points using convex hull and Voronoi
82+
decomposition.
83+
84+
Pre-Filtering:
85+
86+
```
87+
osmium tags-filter -o postcodes.osm.pbf DATA.osm.pbf \
88+
'addr:*' r/postal_code
89+
```
90+
91+
## Topic: Restrictions
92+
93+
Turn restrictions (relations tagged `type=restrictions`) for road navigation.
94+
95+
Pre-Filtering:
96+
97+
```
98+
osmium tags-filter -o restrictions.osm.pbf DATA.osm.pbf \
99+
w/highway w/amenity=parking r/type=restriction
100+
```
101+

themes/explore/init.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- ---------------------------------------------------------------------------
2+
--
3+
-- Theme: explore
4+
--
5+
-- ---------------------------------------------------------------------------
6+
7+
local theme = {}
8+
9+
return theme
10+
11+
-- ---------------------------------------------------------------------------

themes/explore/qgis/coastline.qgz

35.3 KB
Binary file not shown.

themes/explore/qgis/postcodes.qgz

30.4 KB
Binary file not shown.

themes/explore/qgis/restrictions.qgz

53.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)