aboutsummaryrefslogtreecommitdiff
path: root/data_extractor/Makefile
blob: 3506e68fa1341728e12df154e0e14ffa1a3926fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.PHONY: process_data hamburt denmark permission count_per_country db_shell notify_desktop process_data

pbfs:
	mkdir pbfs

pbfs/hamburg-latest.osm.pbf: pbfs
	cd pbfs && wget https://download.geofabrik.de/europe/germany/hamburg-latest.osm.pbf

pbfs/denmark-latest.osm.pbf: pbfs
	cd pbfs && wget https://download.geofabrik.de/europe/denmark-latest.osm.pbf

hamburg: pbfs/hamburg-latest.osm.pbf
	# Load Hamburg
	# sudo -u postgres osm2pgsql -d map -O flex -S data_extractor.lua pbfs/hamburg-latest.osm.pbf --slim --append
	sudo -u postgres psql -d map -c "update poi set region = 'Hamburg' where region IS NULL;"
	sudo -u postgres psql -d map -c "update poi set country = 'Germany' where country IS NULL;"

denmark: pbfs/denmark-latest.osm.pbf
	# Load Denmark, this resets DB
	sudo -u postgres osm2pgsql -d map -O flex -S data_extractor.lua pbfs/denmark-latest.osm.pbf --slim
	sudo -u postgres psql -d map -c "update poi set country = 'Denmark' where country IS NULL;"

count_per_country:
	sudo -u postgres psql -d map -c "select country, count(*) from poi group by country;"

db_shell:
	sudo -u postgres psql -d map

notify_desktop:
	notify-send "OSM processing" "done" || true

process_data: denmark hamburg count_per_country notify_desktop

.DEFAULT_GOAL := process_data