Dockerized Version of the ohsome-api. The current code of the ohsome-api
can be found
at: https://github.com/GIScience/ohsome-api. To see all available docker
images visit: julianpsotta/ohsome-api
- docker
- docker-compose
Either use pre-build docker images or build the images yourself.
If you wish to load a local database instead of using the fallback database (Heidelberg), you have to provide a
valid *.oshdb.mv.db
file from http://downloads.ohsome.org and load it as a volume into
the container as described below. You can leave that folder empty to use the build in fallback database,
covering Heidelberg.
# docker image with pre-build images using a fallback database of heidelberg http://downloads.ohsome.org/v0.6/europe/germany/baden-wuerttemberg/
docker run -dt --name ohsome-api -p 8080:8080 julianpsotta/ohsome-api:latest
# Try the api with an actual request
curl -X POST "http://localhost:8080/contributions/latest/geometry?bboxes=8.67%2C49.39%2C8.71%2C49.42&clipGeometry=true&filter=type%3Away%20and%20natural%3D*&properties=tags&time=2016-01-01%2C2017-01-01" -H "accept: application/json"
Pre-build docker images with a local database named heidelberg_68900_2020-07-23.oshdb.mv.db
which should be copied
to ./data
for this example. If the download fails, or you need a different database
checkout: http://downloads.ohsome.org
curl -O http://downloads.ohsome.org/v0.6/europe/germany/baden-wuerttemberg/heidelberg_68900_2020-07-23.oshdb.mv.db
mkdir ./data && mv heidelberg_68900_2020-07-23.oshdb.mv.db ./data
docker run -dt --name ohsome-api -p 8080:8080 -v "$(pwd)/data:/opt/data" --env DATA_FILE="heidelberg_68900_2020-07-23.oshdb.mv.db" julianpsotta/ohsome-api:1.3.2
# To see what happens inside the container run
docker logs -ft ohsome-api
# Try the api with an actual request
curl -X POST "http://localhost:8080/contributions/latest/geometry?bboxes=8.67%2C49.39%2C8.71%2C49.42&clipGeometry=true&filter=type%3Away%20and%20natural%3D*&properties=tags&time=2016-01-01%2C2017-01-01" -H "accept: application/json"
Use the provided docker-compose.yml
or create one with a similar content:
version: '2.1'
networks:
ohsome:
name: ohsome
services:
ohsome-api:
image: julianpsotta/ohsome-api:1.3.2
container_name: ohsome-api
environment:
DATA_FILE: "your-database.oshdb.mv.db"
volumes:
- ./data:/opt/data
ports:
- 8080:8080
restart: always
networks:
- ohsome
# docker-compose with pre-build images
curl -O http://downloads.ohsome.org/v0.6/europe/germany/baden-wuerttemberg/heidelberg_68900_2020-07-23.oshdb.mv.db
mkdir ./data && mv heidelberg_68900_2020-07-23.oshdb.mv.db ./data
docker-compose up -d
# To see what happens inside the container run
docker-compose logs -ft
# Try the api with an actual request
curl -X POST "http://localhost:8080/contributions/latest/geometry?bboxes=8.67%2C49.39%2C8.71%2C49.42&clipGeometry=true&filter=type%3Away%20and%20natural%3D*&properties=tags&time=2016-01-01%2C2017-01-01" -H "accept: application/json"
Open the docker-compose.yml
file in order to change details e.g. the Version you want to use.
The Dockerfile is always build with Heidelberg as a fallback database. The data itself is highly compressed and is not adding much on the overall image size.
docker build -t julianpsotta/ohsome-api:latest --build-arg OHSOMEAPI_VERSION=latest .
docker-compose -f docker-compose_build.yml build
Open the docker-compose_build.yml
in order to change details e.g. the Version you want to build.
This repository uses pre-commit hooks to make sure all commits meet equal standars. To contribute install pre-commit
first and in the root location of the repository run:
pre-commit clean
pre-commit install
For every submission git will automatically check the installed hooks. To manually execute them, run:
pre-commit run --all-files
- Julian Psotta - Author | Initial work - MichaelsJP
See also the list of contributors who participated in this project.
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007