diff --git a/Makefile b/Makefile index 902ff9f..61cf903 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ PROJECT_ID := dockerosm +COMPOSE_FILE := docker-compose.yml build: @@ -6,42 +7,42 @@ build: @echo "------------------------------------------------------------------" @echo "Building in production mode" @echo "------------------------------------------------------------------" - @docker-compose -p $(PROJECT_ID) build + @docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) build run: @echo @echo "------------------------------------------------------------------" @echo "Running in production mode" @echo "------------------------------------------------------------------" - @docker-compose -p $(PROJECT_ID) up -d --no-recreate + @docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) up -d --no-recreate rundev: @echo @echo "------------------------------------------------------------------" @echo "Running in DEVELOPMENT mode" @echo "------------------------------------------------------------------" - @docker-compose -p $(PROJECT_ID) up + @docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) up stop: @echo @echo "------------------------------------------------------------------" @echo "Stopping in production mode" @echo "------------------------------------------------------------------" - @docker-compose -p $(PROJECT_ID) stop + @docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) stop kill: @echo @echo "------------------------------------------------------------------" @echo "Killing in production mode" @echo "------------------------------------------------------------------" - @docker-compose -p $(PROJECT_ID) kill + @docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) kill rm: kill @echo @echo "------------------------------------------------------------------" @echo "Removing production instance!!! " @echo "------------------------------------------------------------------" - @docker-compose -p $(PROJECT_ID) rm + @docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) rm ipdb: @echo diff --git a/docker-compose.yml b/docker-compose.yml index b58bf9f..675c1d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,8 @@ db: - PASS=docker volumes_from: - storage + ports: + - "5433:5432" imposm: build: docker-imposm3 diff --git a/docker-imposm3/importer.py b/docker-imposm3/importer.py index c6bb946..dd7ef96 100644 --- a/docker-imposm3/importer.py +++ b/docker-imposm3/importer.py @@ -128,7 +128,7 @@ class Importer(object): if clip_file == 'clip.shp': self.clip_shape_file = join(clip_folder, clip_file) if clip_file == 'clip.sql': - self.clip_shape_file = join(clip_folder, clip_file) + self.clip_sql_file = join(clip_folder, clip_file) if not self.osm_file: msg = 'OSM file *.pbf is missing in %s' % self.default['SETTINGS'] @@ -139,7 +139,7 @@ class Importer(object): self.error(msg) if not self.post_import_file: - self.info('No *.sql detected in %s' % self.default['SETTINGS']) + self.info('No custom SQL files *.sql detected in %s' % self.default['SETTINGS']) else: self.info('%s detected for post import.' % self.post_import_file) @@ -155,9 +155,10 @@ class Importer(object): msg = 'clip.shp is missing and CLIP = yes.' self.error(msg) elif self.clip_shape_file and self.default['QGIS_STYLE']: - self.info('%s detected for clipping.' % self.qgis_style) + self.info('%s detected for clipping.' % self.clip_shape_file) + self.info('%s detected for clipping.' % self.clip_sql_file) else: - self.info('No clipping.') + self.info('No *.shp detected in %s, so no clipping.' % self.default['SETTINGS']) # In docker-compose, we should wait for the DB is ready. self.info('The checkup is OK. The container will continue soon, after the database.') diff --git a/docker-osmupdate/download.py b/docker-osmupdate/download.py index 3b31ef9..c23ed01 100644 --- a/docker-osmupdate/download.py +++ b/docker-osmupdate/download.py @@ -151,6 +151,7 @@ class Downloader(object): sleep(2.0) else: # Everything was fine, let's sleeping. + self.info('Creating diff successful : %s' % file_name) self.info('Sleeping for %s seconds.' % self.default['TIME']) sleep(float(self.default['TIME'])) diff --git a/readme.md b/readme.md index bbfa3ec..acbb7f2 100644 --- a/readme.md +++ b/readme.md @@ -2,35 +2,29 @@ ## Usage +### PBF File In this example we will set up an OSM database for South Africa that will pull for updates every 2 minutes. -First get the list of available countries in Geofabrik : -``python pbf_downloader.py list`` - -Now fetch the latest South Africa osm binary dump file (.pbf) and state files: - -You can download a country or a continent : -``python pbf_downloader.py south-africa-and-lesotho`` - -The script will download the PBF file, the state file and the polygon for clipping. - -As an alternative to the above (not all countries are available from geofabrik), you -can also fetch the pbf from another site such as shown in the example below which -will fetch the latest South Africa osm binary dump file (.pbf) and state file from -the French openstreetmap site. Note that you need the ```wget``` command line -application installed on your computer to follow the instructions below. +First get a PBF file from your area and put this file in the 'settings' folder. +You can download some PBF files on these URLS for instance : +* http://download.geofabrik.de/ +* http://download.openstreetmap.fr/extracts/ ``` cd settings wget -c -O country.pbf http://download.openstreetmap.fr/extracts/africa/south_africa.osm.pbf -wget -c -O country.state.txt http://download.openstreetmap.fr/extracts/africa/south_africa.state.txt -wget -c -O polygon.poly http://download.geofabrik.de/africa/south-africa-and-lesotho.poly ``` -You can also visit the http://download.openstreetmap.fr/extracts/ site and -download the extract you want manually using your browser. +### Clipping +You can put a shapefile in the clip folder. This shapefile will be used for clipping every features after the import. + +### QGIS Styles + +### SQL Trigger + +### Build and run Now build the docker images needed to run the application: