forked from migurski/Extractotron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-osmosis-script.py
28 lines (21 loc) · 999 Bytes
/
build-osmosis-script.py
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
from sys import argv, stderr
from csv import DictReader
cities = list(DictReader(open('cities.txt'), dialect='excel-tab'))
try:
(osmosis, ) = argv[1:]
except ValueError:
print >> stderr, 'Usage: build-osmosis-script.py <osmosis command file>'
exit(1)
osmosis = open(osmosis, 'w')
print >> osmosis, 'bunzip2 -c planet-latest.osm.bz2 | osmosis-*/bin/osmosis --rx file=- \\'
print >> osmosis, ' --log-progress interval=60 \\'
#print >> osmosis, ' --tee outputCount=2 \\'
#print >> osmosis, ' --tag-filter accept-ways natural=coastline --used-node \\'
#print >> osmosis, ' --wx coastline.osm.bz2 \\'
print >> osmosis, ' --tee outputCount=%d \\' % len(cities)
print >> osmosis, ' \\'
for city in cities:
print >> osmosis, ' --bb top=%(top)s left=%(left)s bottom=%(bottom)s right=%(right)s \\' % city
print >> osmosis, ' --tee outputCount=2 --wx file=ex/%(slug)s.osm.bz2 --wb file=ex/%(slug)s.osm.pbf \\' % city
print >> osmosis, ';'
osmosis.close()