-
Notifications
You must be signed in to change notification settings - Fork 1
/
update_maps_only_osm.py
48 lines (39 loc) · 1.19 KB
/
update_maps_only_osm.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/python
import sys
import os
import subprocess
import os, shutil, fnmatch
import subprocess
import time
from multiprocessing import Pool
def download(country):
country_name=country[0]
id=country[1]
style=country[2]
url=country[3]
if(not country_name.startswith('#')):
print("Update "+country_name+ " "+id+" "+style+" "+url)
#Launch script
subprocess.run(["bash", "download_osm.sh",country_name,id,style,url])
def createMap(country):
country_name=country[0]
id=country[1]
style=country[2]
url=country[3]
if(not country_name.startswith('#')):
print("Update "+country_name+ " "+id+" "+style+" "+url)
#Launch script
subprocess.run(["bash", "create_map.sh",country_name,id,style])
if __name__ == '__main__':
country_list=[]
#File country
file_in = open("country.txt", "rt")
lines = file_in.readlines()
for line in lines:
result = line.split(";")
country_list.append([result[0],result[1],result[2],result[3]])
file_in.close()
with Pool(processes=4) as pool:
pool.map(download, country_list)
with Pool(processes=2) as pool:
pool.map(createMap, country_list)