Merge pull request #34 from kartoza/update

update documentation and small fixes
pull/37/head
Etienne Trimaille 2016-07-19 17:59:36 +07:00 zatwierdzone przez GitHub
commit 85b14edcce
5 zmienionych plików z 28 dodań i 29 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -22,6 +22,8 @@ db:
- PASS=docker
volumes_from:
- storage
ports:
- "5433:5432"
imposm:
build: docker-imposm3

Wyświetl plik

@ -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.')

Wyświetl plik

@ -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']))

Wyświetl plik

@ -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: