kopia lustrzana https://github.com/kartoza/docker-osm
merge osm_pbf into settings
rodzic
c8a4e47312
commit
5227a13a20
|
@ -1,6 +1,6 @@
|
|||
.idea
|
||||
*.*~
|
||||
osm_pbf/*.pbf
|
||||
osm_pbf/*.state.txt
|
||||
osm_pbf/*.poly
|
||||
settings/*.pbf
|
||||
settings/*.state.txt
|
||||
settings/*.poly
|
||||
settings/last.state.txt
|
||||
|
|
|
@ -3,7 +3,6 @@ storage:
|
|||
hostname: storage
|
||||
volumes:
|
||||
# These are sharable to other containers
|
||||
- ./osm_pbf:/home/osm_pbf
|
||||
- ./settings:/home/settings
|
||||
- /home/import_done
|
||||
- /home/import_queue
|
||||
|
|
|
@ -41,7 +41,6 @@ default = {
|
|||
'PORT': '5432',
|
||||
'SETTINGS': 'settings',
|
||||
'CACHE': 'cache',
|
||||
'OSM_PBF': 'osm_pbf',
|
||||
'IMPORT_DONE': 'import_done',
|
||||
'IMPORT_QUEUE': 'import_queue',
|
||||
'SRID': '4326',
|
||||
|
@ -52,7 +51,6 @@ default = {
|
|||
}
|
||||
|
||||
# Check if we overwrite default values.
|
||||
# env = [var.lower() for var in environ]
|
||||
for key in default.keys():
|
||||
if key in environ:
|
||||
default[key] = environ[key]
|
||||
|
@ -82,7 +80,7 @@ postgis_uri = 'postgis://%s:%s@%s/%s' % (
|
|||
default['DATABASE'])
|
||||
|
||||
# Check folders.
|
||||
folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'OSM_PBF', 'SETTINGS', 'CACHE']
|
||||
folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'SETTINGS', 'CACHE']
|
||||
for folder in folders:
|
||||
if not isabs(default[folder]):
|
||||
# Get the absolute path.
|
||||
|
@ -98,28 +96,27 @@ state_file = None
|
|||
osm_file = None
|
||||
mapping_file = None
|
||||
post_import_file = None
|
||||
for f in listdir(default['OSM_PBF']):
|
||||
for f in listdir(default['SETTINGS']):
|
||||
if f.endswith('.state.txt'):
|
||||
state_file = join(default['OSM_PBF'], f)
|
||||
state_file = join(default['SETTINGS'], f)
|
||||
|
||||
if f.endswith('.pbf'):
|
||||
osm_file = join(default['OSM_PBF'], f)
|
||||
osm_file = join(default['SETTINGS'], f)
|
||||
|
||||
if not osm_file:
|
||||
print >> stderr, 'OSM file *.pbf is missing in %s' % default['OSM_PBF']
|
||||
exit()
|
||||
|
||||
if not state_file:
|
||||
print >> stderr, 'State file *.state.txt is missing in %s' % default['OSM_PBF']
|
||||
exit()
|
||||
|
||||
for f in listdir(default['SETTINGS']):
|
||||
if f.endswith('.json'):
|
||||
mapping_file = join(default['SETTINGS'], f)
|
||||
|
||||
if f.endswith('.sql'):
|
||||
post_import_file = join(default['SETTINGS'], f)
|
||||
|
||||
if not osm_file:
|
||||
print >> stderr, 'OSM file *.pbf is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
||||
if not state_file:
|
||||
print >> stderr, 'State file *.state.txt is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
||||
if not mapping_file:
|
||||
print >> stderr, 'Mapping file *.json is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
|
|
@ -39,7 +39,7 @@ default = {
|
|||
'BASE_URL': 'http://planet.openstreetmap.org/replication/',
|
||||
'IMPORT_QUEUE': 'import_queue',
|
||||
'IMPORT_DONE': 'import_done',
|
||||
'OSM_PBF': 'osm_pbf',
|
||||
'SETTINGS': 'settings',
|
||||
'TIME': 120,
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ for key in default.keys():
|
|||
default[key] = environ[key]
|
||||
|
||||
# Folders
|
||||
folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'OSM_PBF']
|
||||
folders = ['IMPORT_QUEUE', 'IMPORT_DONE', 'SETTINGS']
|
||||
for folder in folders:
|
||||
if not isabs(default[folder]):
|
||||
# Get the absolute path.
|
||||
|
@ -63,26 +63,26 @@ for folder in folders:
|
|||
state_file = None
|
||||
osm_file = None
|
||||
poly_file = None
|
||||
for f in listdir(default['OSM_PBF']):
|
||||
for f in listdir(default['SETTINGS']):
|
||||
if f.endswith('.state.txt'):
|
||||
state_file = join(default['OSM_PBF'], f)
|
||||
state_file = join(default['SETTINGS'], f)
|
||||
|
||||
if f.endswith('.pbf'):
|
||||
osm_file = join(default['OSM_PBF'], f)
|
||||
osm_file = join(default['SETTINGS'], f)
|
||||
|
||||
if f.endswith('.poly'):
|
||||
poly_file = join(default['OSM_PBF'], f)
|
||||
poly_file = join(default['SETTINGS'], f)
|
||||
|
||||
if not state_file:
|
||||
print >> stderr, 'State file *.state.txt is missing in %s' % default['OSM_PBF']
|
||||
print >> stderr, 'State file *.state.txt is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
||||
if not osm_file:
|
||||
print >> stderr, 'OSM file *.osm.pbf is missing in %s' % default['OSM_PBF']
|
||||
print >> stderr, 'OSM file *.osm.pbf is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
||||
if not poly_file:
|
||||
print 'No *.poly detected in %s' % default['OSM_PBF']
|
||||
print 'No *.poly detected in %s' % default['SETTINGS']
|
||||
else:
|
||||
print '%s detected for clipping.' % poly_file
|
||||
|
||||
|
|
|
@ -41,15 +41,15 @@ if url:
|
|||
print 'state : ' + state
|
||||
|
||||
print 'Downloading PBF'
|
||||
commands = ['wget', '-c', '-O', 'osm_pbf/country.pbf', pbf_file]
|
||||
commands = ['wget', '-c', '-O', 'settings/country.pbf', pbf_file]
|
||||
call(commands)
|
||||
|
||||
print 'Downloading polygon'
|
||||
commands = ['wget', '-c', '-O', 'osm_pbf/country.poly', poly_file]
|
||||
commands = ['wget', '-c', '-O', 'settings/country.poly', poly_file]
|
||||
call(commands)
|
||||
|
||||
print 'Downloading state'
|
||||
commands = ['wget', '-c', '-O', 'osm_pbf/country.state.txt', state]
|
||||
commands = ['wget', '-c', '-O', 'settings/country.state.txt', state]
|
||||
call(commands)
|
||||
|
||||
else:
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
This folder should contain a json file for the mapping. You can also put a
|
||||
SQL file, it will be executed after the PBF import.
|
||||
|
||||
Optionally you can include a .poly file (see http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format)
|
||||
in this directory, which will be used as the clip extents for diffs. The
|
||||
base name of the .poly file is not important - the first .poly file encountered
|
||||
in this folder will be used.
|
Ładowanie…
Reference in New Issue