-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathimport_osm.eu1000
executable file
·108 lines (69 loc) · 6.19 KB
/
import_osm.eu1000
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
cd osm
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];(node(35,-10,75,40)[place~"city|town"];);(._;node(w);); out;' -O - | bzip2 > places.osm.bz2
echo "DROP INDEX places_point_pkey,places_point_index;" | psql -d gis_eu_1000
/usr/bin/osm2pgsql \
-d gis_eu_1000 \
--style "/root/map1/osm2pgsql/places.style" \
--create \
--slim --cache 30 \
--prefix places \
places.osm.bz2
echo "ALTER TABLE places_point RENAME TO places; DROP TABLE places_line,places_polygon,places_nodes,places_rels,places_roads,places_ways;" | psql -d gis_eu_1000
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];(rel(35,-10,75,40)[boundary="administrative"]["admin_level"~"2|3|4"];);(._;way(r););(._;node(w);); out;' -O - | bzip2 > adminboundary.osm.bz2
echo "DROP INDEX adminboundary_polygon_pkey,adminboundary_polygon_index;" | psql -d gis_eu_1000
/usr/bin/osm2pgsql \
-d gis_eu_1000 \
--style "/root/map1/osm2pgsql/adminboundary.style" \
--create \
--slim --cache 30 \
--prefix adminboundary \
adminboundary.osm.bz2
echo "ALTER TABLE adminboundary_polygon RENAME TO adminboundary; DROP TABLE adminboundary_line; DROP TABLE adminboundary_point,adminboundary_nodes,adminboundary_rels,adminboundary_roads,adminboundary_ways;" | psql -d gis_eu_1000
echo "UPDATE adminboundary SET way = ST_SimplifyPreserveTopology(way,1000);" | psql -d gis_eu_1000
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];(way(35,-10,75,40)[highway~"motorway|trunk|primary"];);(._;node(w);); out;' -O - | bzip2 > highway.osm.bz2
echo "DROP INDEX highway_line_pkey,highway_line_index;" | psql -d gis_eu_1000
/usr/bin/osm2pgsql \
-d gis_eu_1000 \
--style "/root/map1/osm2pgsql/highway.style" \
--create \
--slim --cache 30 \
--prefix highway \
highway.osm.bz2
echo "ALTER TABLE highway_line RENAME TO highway; DROP TABLE highway_polygon; DROP TABLE highway_point,highway_nodes,highway_rels,highway_roads,highway_ways;" | psql -d gis_eu_1000
echo "UPDATE highway SET way = ST_SimplifyPreserveTopology(way,1000);" | psql -d gis_eu_1000
echo "ALTER TABLE highway ADD COLUMN name TEXT;" | psql -d gis_eu_1000
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];(rel(35,-10,75,40)[waterway="river|canal"];);(._;way(r););(._;node(w););(way(35,-10,75,40)[waterway="river"];);(._;node(w);); out;' -O - | bzip2 > waterway.osm.bz2
echo "DROP INDEX waterway_line_pkey,waterway_line_index;" | psql -d gis_eu_1000
/usr/bin/osm2pgsql \
-d gis_eu_1000 \
--style "/root/map1/osm2pgsql/waterway.style" \
--create \
--slim --cache 30 \
--prefix waterway \
waterway.osm.bz2
echo "ALTER TABLE waterway_line RENAME TO waterway; DROP TABLE waterway_polygon; DROP TABLE waterway_point,waterway_nodes,waterway_rels,waterway_roads,waterway_ways;" | psql -d gis_eu_1000
echo "UPDATE waterway SET way = ST_SimplifyPreserveTopology(way,1000);" | psql -d gis_eu_1000
#wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];((((rel(35,-10,75,40)[waterway~"riverbank|dam"];);(rel(35,-10,75,40)[natural~"water|wetland|marsh"];);(rel(35,-10,75,40)[landuse="resorvoir"];););(._;way(r););(._;node(w);););(((way(35,-10,75,40)[waterway~"riverbank|dam"];);(way(35,-10,75,40)[natural~"water|wetland|marsh"];);(way(35,-10,75,40)[landuse="resorvoir"];););(._;node(w);););); out;' -O - | bzip2 > waterarea.osm.bz2
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];((rel(35,-10,75,0)[waterway="riverbank"];rel(35,-10,75,0)[natural="water"];);(._;way(r););(._;node(w););(way(35,-10,75,0)[waterway="riverbank"];way(35,-10,75,0)[natural="water"];);(._;node(w););); out;' -O - | bzip2 > waterarea1.osm.bz2
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];((rel(35,0,75,10)[waterway="riverbank"];rel(35,0,75,10)[natural="water"];);(._;way(r););(._;node(w););(way(35,0,75,10)[waterway="riverbank"];way(35,0,75,10)[natural="water"];);(._;node(w););); out;' -O - | bzip2 > waterarea2.osm.bz2
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];((rel(35,10,75,20)[waterway="riverbank"];rel(35,10,75,20)[natural="water"];);(._;way(r););(._;node(w););(way(35,10,75,20)[waterway="riverbank"];way(35,10,75,20)[natural="water"];);(._;node(w););); out;' -O - | bzip2 > waterarea3.osm.bz2
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];((rel(35,20,75,30)[waterway="riverbank"];rel(35,20,75,30)[natural="water"];);(._;way(r););(._;node(w););(way(35,20,75,30)[waterway="riverbank"];way(35,20,75,30)[natural="water"];);(._;node(w););); out;' -O - | bzip2 > waterarea4.osm.bz2
wget --timeout=7300 'http://overpass-api.de/api/interpreter?data=[timeout:7200];((rel(35,30,75,40)[waterway="riverbank"];rel(35,30,75,40)[natural="water"];);(._;way(r););(._;node(w););(way(35,30,75,40)[waterway="riverbank"];way(35,30,75,40)[natural="water"];);(._;node(w););); out;' -O - | bzip2 > waterarea5.osm.bz2
bunzip2 -c waterarea1.osm.bz2 | ./osmconvert - -o=waterarea1.o5m
bunzip2 -c waterarea2.osm.bz2 | ./osmconvert - -o=waterarea2.o5m
bunzip2 -c waterarea3.osm.bz2 | ./osmconvert - -o=waterarea3.o5m
bunzip2 -c waterarea4.osm.bz2 | ./osmconvert - -o=waterarea4.o5m
bunzip2 -c waterarea5.osm.bz2 | ./osmconvert - -o=waterarea5.o5m
./osmconvert waterarea1.o5m waterarea2.o5m waterarea3.o5m waterarea4.o5m waterarea5.o5m --out-osm | bzip2 > waterarea.osm.bz2
echo "DROP TABLE waterarea; DROP INDEX waterarea_polygon_pkey,waterarea_polygon_index;" | psql -d gis_eu_1000
unlink "waterarea1.osm.bz2"; unlink "waterarea2.osm.bz2"; unlink "waterarea1.o5m"; unlink "waterarea2.o5m"; unlink "waterarea3.osm.bz2"; unlink "waterarea4.osm.bz2"; unlink "waterarea3.o5m"; unlink "waterarea4.o5m"; unlink "waterarea5.o5m"; unlink "waterarea5.osm.bz2";
/usr/bin/osm2pgsql \
-d gis_eu_1000 \
--style "/root/map1/osm2pgsql/waterarea.style" \
--create \
--slim --cache 30 \
--prefix waterarea \
waterarea.osm.bz2
echo "ALTER TABLE waterarea_polygon RENAME TO waterarea; DROP TABLE waterarea_line; DROP TABLE waterarea_point,waterarea_nodes,waterarea_rels,waterarea_roads,waterarea_ways;" | psql -d gis_eu_1000
echo "UPDATE waterarea SET way = ST_SimplifyPreserveTopology(way,1000);" | psql -d gis_eu_1000