kopia lustrzana https://github.com/kartoza/docker-osm
commit
85b14edcce
13
Makefile
13
Makefile
|
@ -1,4 +1,5 @@
|
||||||
PROJECT_ID := dockerosm
|
PROJECT_ID := dockerosm
|
||||||
|
COMPOSE_FILE := docker-compose.yml
|
||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
@ -6,42 +7,42 @@ build:
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@echo "Building in production mode"
|
@echo "Building in production mode"
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@docker-compose -p $(PROJECT_ID) build
|
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) build
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@echo
|
@echo
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@echo "Running in production mode"
|
@echo "Running in production mode"
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@docker-compose -p $(PROJECT_ID) up -d --no-recreate
|
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) up -d --no-recreate
|
||||||
|
|
||||||
rundev:
|
rundev:
|
||||||
@echo
|
@echo
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@echo "Running in DEVELOPMENT mode"
|
@echo "Running in DEVELOPMENT mode"
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@docker-compose -p $(PROJECT_ID) up
|
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) up
|
||||||
|
|
||||||
stop:
|
stop:
|
||||||
@echo
|
@echo
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@echo "Stopping in production mode"
|
@echo "Stopping in production mode"
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@docker-compose -p $(PROJECT_ID) stop
|
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) stop
|
||||||
|
|
||||||
kill:
|
kill:
|
||||||
@echo
|
@echo
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@echo "Killing in production mode"
|
@echo "Killing in production mode"
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@docker-compose -p $(PROJECT_ID) kill
|
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) kill
|
||||||
|
|
||||||
rm: kill
|
rm: kill
|
||||||
@echo
|
@echo
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@echo "Removing production instance!!! "
|
@echo "Removing production instance!!! "
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@docker-compose -p $(PROJECT_ID) rm
|
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) rm
|
||||||
|
|
||||||
ipdb:
|
ipdb:
|
||||||
@echo
|
@echo
|
||||||
|
|
|
@ -22,6 +22,8 @@ db:
|
||||||
- PASS=docker
|
- PASS=docker
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- storage
|
- storage
|
||||||
|
ports:
|
||||||
|
- "5433:5432"
|
||||||
|
|
||||||
imposm:
|
imposm:
|
||||||
build: docker-imposm3
|
build: docker-imposm3
|
||||||
|
|
|
@ -128,7 +128,7 @@ class Importer(object):
|
||||||
if clip_file == 'clip.shp':
|
if clip_file == 'clip.shp':
|
||||||
self.clip_shape_file = join(clip_folder, clip_file)
|
self.clip_shape_file = join(clip_folder, clip_file)
|
||||||
if clip_file == 'clip.sql':
|
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:
|
if not self.osm_file:
|
||||||
msg = 'OSM file *.pbf is missing in %s' % self.default['SETTINGS']
|
msg = 'OSM file *.pbf is missing in %s' % self.default['SETTINGS']
|
||||||
|
@ -139,7 +139,7 @@ class Importer(object):
|
||||||
self.error(msg)
|
self.error(msg)
|
||||||
|
|
||||||
if not self.post_import_file:
|
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:
|
else:
|
||||||
self.info('%s detected for post import.' % self.post_import_file)
|
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.'
|
msg = 'clip.shp is missing and CLIP = yes.'
|
||||||
self.error(msg)
|
self.error(msg)
|
||||||
elif self.clip_shape_file and self.default['QGIS_STYLE']:
|
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:
|
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.
|
# 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.')
|
self.info('The checkup is OK. The container will continue soon, after the database.')
|
||||||
|
|
|
@ -151,6 +151,7 @@ class Downloader(object):
|
||||||
sleep(2.0)
|
sleep(2.0)
|
||||||
else:
|
else:
|
||||||
# Everything was fine, let's sleeping.
|
# Everything was fine, let's sleeping.
|
||||||
|
self.info('Creating diff successful : %s' % file_name)
|
||||||
self.info('Sleeping for %s seconds.' % self.default['TIME'])
|
self.info('Sleeping for %s seconds.' % self.default['TIME'])
|
||||||
sleep(float(self.default['TIME']))
|
sleep(float(self.default['TIME']))
|
||||||
|
|
||||||
|
|
32
readme.md
32
readme.md
|
@ -2,35 +2,29 @@
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
### PBF File
|
||||||
In this example we will set up an OSM database for South Africa that
|
In this example we will set up an OSM database for South Africa that
|
||||||
will pull for updates every 2 minutes.
|
will pull for updates every 2 minutes.
|
||||||
|
|
||||||
First get the list of available countries in Geofabrik :
|
First get a PBF file from your area and put this file in the 'settings' folder.
|
||||||
``python pbf_downloader.py list``
|
You can download some PBF files on these URLS for instance :
|
||||||
|
* http://download.geofabrik.de/
|
||||||
Now fetch the latest South Africa osm binary dump file (.pbf) and state files:
|
* http://download.openstreetmap.fr/extracts/
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd settings
|
cd settings
|
||||||
wget -c -O country.pbf http://download.openstreetmap.fr/extracts/africa/south_africa.osm.pbf
|
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
|
### Clipping
|
||||||
download the extract you want manually using your browser.
|
|
||||||
|
|
||||||
|
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:
|
Now build the docker images needed to run the application:
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue