-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathload-dump.sh
executable file
·54 lines (40 loc) · 1.47 KB
/
load-dump.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
date
echo "start import $1"
echo "convert to all.o5m"
osmconvert "$1" -o=all.o5m
echo "done"
date
echo "filter data"
osmfilter all.o5m --keep="admin_level= place= addr:housenumber= addr:interpolation= type=associatedStreet" --keep-ways="(highway= or area:highway= )and name= " -o=addresses.o5m
rm all.o5m
echo "done"
date
echo "filter places and boundaries"
osmfilter addresses.o5m --keep="admin_level= place= " -o=boundaries.o5m
date
echo "filter buildings and streets"
osmfilter addresses.o5m --keep="addr:housenumber= addr:housename= type=associatedStreet" --keep-ways="(highway=motorway =trunk =primary =secondary =tertiary =residential =unclassified = service =track =pedestrian =footway) and name=" --keep="area:highway= and name=" -o=buildings.o5m
date
echo "filter addr interpolation"
osmfilter addresses.o5m --keep="addr:interpolation=" -o=interpolation.o5m
rm addresses.o5m
date
echo "simplify"
osmconvert buildings.o5m --all-to-nodes --max-objects=50000000 -o=buildings-simple.o5m
echo "done"
rm buildings.o5m
date
echo "merge data"
osmconvert boundaries.o5m buildings-simple.o5m interpolation.o5m -o=addr-data.pbf
rm streets.o5m buildings-simple.o5m interpolation.o5m
date
echo "clean snapshot"
osmosis --truncate-pgsql database=osm_snapshot user=dkiselev password=123
echo "done"
date
echo "import data"
osmosis --read-pbf addr-data.pbf --write-pgsql nodeLocationStoreType=TempFile database=osm_snapshot user=dkiselev password=123
rm addr-data.pbf
date
echo "all done."