kopia lustrzana https://github.com/kartoza/docker-osm
commit
1b600bf5af
|
@ -0,0 +1 @@
|
|||
{"europe": ["albania", "andorra", "austria", "azores", "belarus", "belgium", "bosnia-herzegovina", "bulgaria", "croatia", "cyprus", "czech-republic", "denmark", "estonia", "faroe-islands", "finland", "france", "georgia", "germany", "great-britain", "greece", "hungary", "iceland", "ireland-and-northern-ireland", "isle-of-man", "italy", "kosovo", "latvia", "liechtenstein", "lithuania", "luxembourg", "macedonia", "malta", "moldova", "monaco", "montenegro", "netherlands", "norway", "poland", "portugal", "romania", "russia-european-part", "serbia", "slovakia", "slovenia", "spain", "sweden", "switzerland", "turkey", "ukraine", "alps", "british-isles", "dach"], "central-america": ["belize", "cuba", "guatemala", "haiti-and-domrep", "nicaragua"], "antartica": [], "north-america": ["canada", "greenland", "mexico", "us-midwest", "us-northeast", "us-pacific", "us-south", "us-west"], "africa": ["benin", "botswana", "burkina-faso", "cameroon", "canary-islands", "congo-democratic-republic", "egypt", "ethiopia", "guinea", "guinea-bissau", "ivory-coast", "kenya", "lesotho", "liberia", "libya", "madagascar", "morocco", "nigeria", "sierra-leone", "somalia", "south-africa-and-lesotho", "tanzania"], "asia": ["azerbaijan", "bangladesh", "china", "gcc-states", "india", "indonesia", "iran", "iraq", "israel-and-palestine", "japan", "jordan", "kazakhstan", "kyrgyzstan", "lebanon", "malaysia-singapore-brunei", "mongolia", "nepal", "north-korea", "pakistan", "philippines", "russia-asian-part", "south-korea", "sri-lanka", "syria", "taiwan", "tajikistan", "thailand", "turkmenistan", "uzbekistan", "vietnam"], "australia-oceania": ["australia", "fiji", "new-caledonia", "new-zealand"], "south-america": ["argentina", "bolivia", "brazil", "chile", "colombia", "ecuador", "paraguay", "peru", "uruguay"]}
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
from json import loads
|
||||
from subprocess import call
|
||||
|
||||
URL = 'http://download.geofabrik.de/'
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print 'Not enough argument. "list" or a name (continent or country)'
|
||||
exit()
|
||||
|
||||
# The JSON file comes from https://gist.github.com/Gustry/4e14bf096cdec09a3e57
|
||||
json_data = open('countries.json').read()
|
||||
data = loads(json_data)
|
||||
|
||||
if sys.argv[1] == 'list':
|
||||
for continent, countries in data.items():
|
||||
print continent
|
||||
for country in countries:
|
||||
print ' ' + country
|
||||
exit()
|
||||
else:
|
||||
area = sys.argv[1]
|
||||
url = None
|
||||
for continent, countries in data.items():
|
||||
if area == continent:
|
||||
url = URL + area
|
||||
else:
|
||||
if area in countries:
|
||||
url = URL + continent + '/' + area
|
||||
|
||||
if url:
|
||||
poly_file = url + '.poly'
|
||||
pbf_file = url + '-latest.osm.pbf'
|
||||
diff = url + '-updates/'
|
||||
state = diff + 'state.txt'
|
||||
print 'Polygon file : ' + poly_file
|
||||
print 'PBF file : ' + pbf_file
|
||||
print 'Diff (not used): ' + diff
|
||||
print 'state : ' + state
|
||||
|
||||
print 'Downloading PBF'
|
||||
commands = ['wget', '-c', '-O', 'osm_pbf/country.pbf', pbf_file]
|
||||
call(commands)
|
||||
|
||||
print 'Downloading polygon'
|
||||
commands = ['wget', '-c', '-O', 'osm_pbf/country.poly', poly_file]
|
||||
call(commands)
|
||||
|
||||
print 'Downloading state'
|
||||
commands = ['wget', '-c', '-O', 'osm_pbf/country.state.txt', state]
|
||||
call(commands)
|
||||
|
||||
else:
|
||||
print 'This area is unkown in geofabrik or in our script. Check with the list argument.'
|
||||
|
Ładowanie…
Reference in New Issue