GithubHelp home page GithubHelp logo

dimasciput / docker-osm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kartoza/docker-osm

0.0 2.0 0.0 215 KB

License: GNU General Public License v2.0

Makefile 0.68% Python 3.23% C 72.73% PLpgSQL 0.10% SQLPL 23.05% HTML 0.22%

docker-osm's Introduction

Docker-OSM

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

cd settings
wget -c -O country.pbf http://download.openstreetmap.fr/extracts/africa/south_africa.osm.pbf

Clipping

You can put a shapefile in the clip folder. This shapefile will be used for clipping every features after the import. This file has to be named 'clip.shp'. When the database container is running, import the shapefile in the database using the command : 'make import_clip'.

You can remove the clip file : 'make remove_clip'.

QGIS Styles

'make import_styles' 'make remove_styles' 'make backup_styles'

SQL Trigger

Build and run

Now build the docker images needed to run the application:

docker-compose build
docker-compose up

In production you should daemonize the services when bringing them up:

docker-compose up -d

You can check the timestamp of your database by reading the file : 'settings/timestamp.txt' or you can use : 'make timestamp'

Docker OSM Update

This docker image when run will fetch on a regular interval any new diff file for all the changes that have happened in the world over the update interval.

You can also specify a custom url for fetching the diff if you wish to retrieve regional diffs rather than the global one.

You can specify a polygonal area for the diff so that it will only apply features from the diff that fall within that area. For example providing a polygon of the borders of Malawi will result in only Malawi features being extracted from the diff.

Note that the diff retrieved and options specified here are not related to the initial base map used - so for example if your initial base map is for Malawi and you specify a diff area in Botswana, updated features in Botswana will be applied to your base map which only includes features from Malawi. For this reason, take care to ensure that your diff area coincides with the region covered by your original base map.

Once the diff has been downloaded, it is placed into /home/import_queue where it will be picked up by the long running imposm3 container, which will apply the diff to the database.

You should have 3 folders : osm_pbf, import_queue, import_done

Put a state file in base-pbf like this one : http://download.openstreetmap.fr/extracts/africa/south_africa.state.txt

docker build -t osmupdate . docker run -v $('pwd')import-queue/:/home/import-queue -v $('pwd')base-pbf/:/home/base-pbf -v $('pwd')import-done/:/home/import-done -d osmupdate

With -e, you can add some settings :

  • MAX_DAYS = 100, the maximum time range to assemble a cumulated changefile.
  • DIFF = sporadic, osmupdate uses a combination of minutely, hourly and daily changefiles. This value can be minute, hour, day or sporadic.
  • MAX_MERGE = 7, argument to determine the maximum number of parallely processed changefiles.
  • COMPRESSION_LEVEL = 1, define level for gzip compression. values between 1 (low compression but fast) and 9 (high compression but slow)
  • BASE_URL = http://planet.openstreetmap.org/replication/, change the URL to use a custom URL to fetch regional file updates.
  • IMPORT_QUEUE = import_queue
  • IMPORT_DONE = import_done
  • OSM_PBF = osm_pbf
  • TIME = 120, seconds between two executions of the script

If you are using docker-compose, you can use these settings within the docker-compose.yml file.

Docker ImpOSM3

This image will take care of doing the initial load for the selected region (e.g. planet, or a country such as Malawi) into your database. It will then apply, at a regular interval (default is 2 minutes), any diff that arrives in the /home/import_queue folder to the postgis OSM database. The diffs are fetched by a separate container (see osm_update container).

The container will look for an OSM file (.pbf) and its state file (.state.txt) in BASE_PBF.

With -e, you can add some settings :

You can adjust these preferences in the docker-compose.yml file provided in this repository.

Technical architecture

Lucidchart

Credits

This application was designed and implemented by:

With some important design ideas provided by Ariel Nunez ([email protected]).

Parts of this project are built on the existing work of others.

July 2015

docker-osm's People

Contributors

gustry avatar timlinux avatar danielcaldwell avatar gubuntu avatar imresamu avatar julien-noblet avatar

Watchers

James Cloos avatar Dimas Ciputra avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.