Giter VIP home page Giter VIP logo

osmose-backend's Introduction

Backend part of Osmose QA tool

This is the part of osmose [http://osmose.openstreetmap.fr] which analyses OSM and send results to frontend. This works as following:

  • an .osm.bz2 or .osm.pbf extract is downloaded from a path
  • downloaded file is converted to .osm, with bunzip2 or osmconvert
  • if necessary, an osmosis dump is generated in a local database
  • analyses are run directly on .osm file, or on the database
  • analyses are stored on a local webserver, and a link is sent to the frontend so that it can download the results
  • temporary extract files and database are purged

Installation Python

Osmose QA backend requires python > 2.6.

Setup system dependencies (Ubuntu Server 14.04)

apt install python

You can install python dependencies in the system or in a virtualenv.

In the system install the folowing packages:

apt install python-dateutil python-imposm-parser python-lockfile python-polib python-poster python-psycopg2 python-shapely python-regex

Alternatively instal python-virtualenv and create a new virtualenv.

Setup system dependencies (Ubuntu Server 14.04)

apt install git python-dev python-virtualenv libpq-dev protobuf-compiler libprotobuf-dev

Create a python virtualenv, active it and install python dependencies

virtualenv --python=python2.7 osmose-backend-venv
source osmose-backend-venv/bin/activate
pip install -r requirements.txt

To run tests, additional packages are needed.

pip install -r requirements-dev.txt

Installation Database

Setup system dependencies (Ubuntu Server 14.04)

apt install postgresql-9.3 postgresql-contrib-9.3 postgresql-9.3-postgis-2.1

As postgres user:

createuser osmose
# Set your own password
psql -c "ALTER ROLE osmose WITH PASSWORD '-osmose-';"
createdb -E UTF8 -T template0 -O osmose osmose
# Enable extensions
psql -c "CREATE extension hstore; CREATE extension fuzzystrmatch; CREATE extension unaccent; CREATE extension postgis;" osmose
psql -c "GRANT SELECT,UPDATE,DELETE ON TABLE spatial_ref_sys TO osmose;" osmose
psql -c "GRANT SELECT,UPDATE,DELETE,INSERT ON TABLE geometry_columns TO osmose;" osmose

Dependencies

Java JRE for osmosis (Ubuntu Server 14.04):

apt install openjdk-7-jre-headless

osmosis is installed in osmosis/osmosis-0.44/. osmconvert is installed in osmconvert/.

Configuration

A few paths are hardcoded in modules/config.py, and should be adapted or created.

  • dir_osmose is the path of where osmose is installed
  • dir_work is where extracts are stored, and results generated.
  • url_frontend_update is the url used to send results generated by analyses

The local postgresql database should be configured in osmose_config.py:

  • db_base = osmose # database name
  • db_user = osmose # database user
  • db_password = # database password if needed
  • db_host = # database hostname if needed

You may want to include this info in ~/.pgpass to avoid entering the database password while processing the files.

See https://wiki.postgresql.org/wiki/Pgpass for more info.

Run

Look at the osmose_run.py help for options

osmose_run.py -h

Connection to the "official" frontend at http://osmose.openstreetmap.fr

When you have configured the backend for the country you want to add, please send an email to [email protected]. We will then send you the password to use to connect to the frontend.

Docker

You can also run osmose-backend in a Docker container. The advantage is that you do not need to setup and configure Python, Java and Postgresql on your system.

The Dockerfile provided in this repository can be used to build an image containing osmose and a Postgresql instance.

To build the image run this command in the root of the repository:

docker build -t osmose-backend .

Taking the comoros (a quick one) as an example, once you have the image, you can run osmose checks like this:

docker run -it --rm osmose-backend --country=comoros

This will run interactively and you will see the output scrolling on your screen. The container will be deleted at the end and no data will be saved on disk.

If, instead, you want to keep the output files locally you can add a volume in the right location, like this:

docker run -it --rm -v /tmp:/data/work/osmose osmose-backend --country=comoros

The directory on your host, /tmp in this case, needs to be writable by everyone, as the osmose user in the container will have some random UID (probably 1000).

Finally, to run with the password file and enable result upload to the frontend you can use the following command line:

docker run -it --rm -v $PWD/osmose_config_password.py:/opt/osmose-backend/osmose_config_password.py osmose-backend --country=comoros

osmose-backend's People

Contributors

jocelynj avatar frodrigo avatar nlehuby avatar panieravide avatar naoliv avatar didier2020 avatar tkas avatar dvenza avatar fgouget avatar olasd avatar cristiancantoro avatar stephankn avatar mgax avatar kreed avatar bagage avatar grischard avatar jmontane avatar rodo avatar sidjy avatar tyndare avatar etchove avatar

Watchers

James Cloos avatar  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.