• Stars
    star
    171
  • Rank 222,266 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ“ Openpoiservice is a flask application which hosts a highly customizable points of interest database derived from OpenStreetMap data.

Openpoiservice

Tests

Openpoiservice (ops) is a flask application which hosts a highly customizable points of interest database derived from OpenStreetMap.org data and thereby exploits its notion of tags...

OpenStreetMap tags consisting of a key and value describe specific features of map elements (nodes, ways, or relations) or changesets. Both items are free format text fields, but often represent numeric or other structured items.

This service consumes OSM tags on nodes, ways and relations by grouping them into predefined categories. If it picks up an OSM object tagged with one of the osm keys defined in categories.yml it will import this point of interest with specific additional tags which may be defined in ops_settings.yml. Any additional tag, for instance wheelchair or smoking may then be used to query the service via the API after import.

For instance, if you want to request all pois accessible by wheelchair within a geometry, you could add then add wheelchair: ['yes', 'dedicated] in filters within the body of your HTTP POST request.

You may pass 3 different types of geometry within the request to the database. Currently, "Point" and "LineString" with a corresponding and buffer are supported as well as a polygon. Points of interest will be returned within the given geometry.

You can control the maximum size of geometries and further restrictions in the settings file of this service.

Import Process

The osm file(s) to be imported are parsed several times to extract points of interest from relations (osm_type 3), ways (osm_type 2) and nodes (osm_type 1) in order. Which type the specific point of interest originated from will be returned within the response - this will help you find the object directly on OpenStreetMap.org.

Installation

You can either run openpoiservice on your host machine in a virtual environment or simply with Docker. The Dockerfile provided installs a WSGI server (gunicorn) which starts the flask service on port 5000.

Technical specs for storing and importing OSM files

Python version

As this service makes use of the python collections library, in particular the notion of deque's and its functions it only supports python 3.5 and greater.

Database

This application uses a psql/postgis setup for storing the points of interest. We highly recommend using this docker container.

Importer

Please consider the following technical requirements for parsing & importing osm files.

Region Memory
Germany 8 GB
Europe 32 GB
Planet 128 GB

Note: Openpoiservice will import any osm pbf file located in the osm folder or subdirectory within. This way you can split the planet file into smaller regions (e.g. download from Geofabrik, scraper script for the download links to be found in the osm folder) and use a smaller instance to import the global data set (as long as the OSM files don't exceed 5 GB of disk space, 16 GB of memory will suffice to import the entire planet).

Run as Docker Container (Flask + Gunicorn)

Make your necessary changes to the settings in the file ops_settings_docker.yml and to categories if you need inside categories_docker.yml. These files are mounted as volumes to the docker container. If you are planning to import a different osm file, please download it to the osm folder (any folder within will be scanned for osm files) as this will be a shared volume.

Docker Compose

All-in-one docker image

This docker-compose will allow you to run openpoiservice with psql/postgis image. This will allow you to deploy this project fast.

Important : The database is not exposed, you won't be able to access it from outside the container. If you want to acces it simply adds those lines to the database definition inside the docker-compose-with-postgis.yml:

ports:
   - <PORT YOU WANT>:5432

Don't forget to change the host name and port inside ops_settings_docker.yml by the one given to docker container for database.

  • Hostname default value : psql_postgis_db
  • Port default value : 5432

Notes : If openpoiservice can't connect to the database, it's probably because you don't have the same settings inside ops_settings_docker.yml and docker-compose-with-postgis.yml.

Command to use to run all-in-one docker container

docker-compose -f /path/to/docker-compose.yml up api -d

Only deploy openpoiservice

This will only run openpoiservice inside a container, meaning that you will need to handle the database yourself and connect it to this container.

docker-compose -f /path/to/docker-compose-standalone.yml up api -d

After deploy

Once the container is built you can either, create the empty database:

$ docker exec -it container_name /ops_venv/bin/python manage.py create-db

Delete the database:

$ docker exec -it container_name /ops_venv/bin/python manage.py drop-db

Or import the OSM data:

$ docker exec -it container_name /ops_venv/bin/python manage.py import-data

Init and Update DB with docker

You can initialize POI database with docker service init

docker-compose -f /path/to/docker-compose.yml up init

Or updating POI database

docker-compose -f /path/to/docker-compose.yml up update

Protocol Buffers (protobuf) for imposm.parser

This repository uses imposm.parser to parse the OpenStreetMap pbf files which uses google's protobuf library under its hood.

The imposm.parser requirement will not build with pip unless you are running protobuf 3.0.0.

To this end, please make sure that you are running the aforementioned version of protobuf if pip install -r requirements.txt fails (install protobuf from source)

Prepare settings.yml

Update openpoiservice/server/ops_settings.yml with your necessary settings and then run one of the following commands.

[

$ export APP_SETTINGS="openpoiservice.server.config.ProductionConfig|DevelopmentConfig"

]

Create the POI DB

$ python manage.py create-db

Drop the POI DB

$ python manage.py drop-db

Parse and import OSM data

$ python manage.py import-data

Run the Application with Flask-Werkzeug

$ python manage.py run

Per default you can access the application at the address http://localhost:5000/

Want to specify a different port?

$ python manage.py run -h 0.0.0.0 -p 8080

Tests

$ export TESTING="True" && python manage.py test

Category IDs and their configuration

openpoiservice/server/categories/categories.yml is a list of (note: not all!) OpenStreetMap tags with arbitrary category IDs. If you keep the structure as follows, you can manipulate this list as you wish.

transport:
   id: 580
   children:
       aeroway:
           aerodrome: 581        
           aeroport: 582 
           helipad: 598         
           heliport: 599 
       amenity:
           bicycle_parking: 583  
           
sustenance:
   id: 560             
   children:
       amenity:
           bar: 561             
           bbq: 562   
...

Openpoiservice uses this mapping while it imports pois from the OpenStreetMap data and assigns the custom category IDs accordingly.

column_mappings in openpoiservice/server/ops_settings.yml controls which OSM information will be considered in the database and also if these may be queried by the user via the API , e.g.

wheelchair:

smoking:

fees:

For instance means that the OpenStreetMap tag wheelchair will be considered during import and save to the database. A user may then add a list of common values in the filters object wheelchair: ['yes', 'dedicated', ...] which correspond to the OSM common values of the tag itself, e.g. https://wiki.openstreetmap.org/wiki/Key:wheelchair.

API Documentation

The documentation for this flask service is provided via flasgger and can be accessed via http://localhost:5000/apidocs/.

Generally you have three different request types pois, stats and list.

Using request=pois in the POST body will return a GeoJSON FeatureCollection in your specified bounding box or geometry.

Using request=stats will do the same but group by the categories, ultimately returning a JSON object with the absolute numbers of pois of a certain group.

Finally, request=list will return a JSON object generated from openpoiservice/server/categories/categories.yml.

Endpoints

The default base url is http://localhost:5000/.

The openpoiservice holds the endpoint /pois:

Method allowed Parameter Values [optional]
POST request pois, stats, list
geometry bbox, geojson, buffer
filter category_group_ids, category_ids, [name, wheelchair, smoking, fee]
limit integer
sortby category, distance

Examples

POIS around a buffered point
curl -X POST \
  http://localhost:5000/pois \
  -H 'Content-Type: application/json' \
  -d '{
  "request": "pois",
  "geometry": {
    "bbox": [
      [8.8034, 53.0756],
      [8.7834, 53.0456]
    ],
    "geojson": {
      "type": "Point",
      "coordinates": [8.8034, 53.0756]
    },
    "buffer": 250  
  }
}'
POIs of given categories
curl -X POST \
  http://localhost:5000/pois \
  -H 'Content-Type: application/json' \
  -d '{
  "request": "pois",
  "geometry": {
    "bbox": [
      [8.8034, 53.0756],
      [8.7834, 53.0456]
    ],
    "geojson": {
      "type": "Point",
      "coordinates": [8.8034, 53.0756]
    },
    "buffer": 100  
  },
  "limit": 200,
  "filters": {
    "category_ids": [180, 245]
  } 
}'
POIs of given category groups
curl -X POST \
  http://localhost:5000/pois \
  -H 'Content-Type: application/json' \
  -d '{
  "request": "pois",
  "geometry": {
    "bbox": [
      [8.8034, 53.0756],
      [8.7834, 53.0456]
    ],
    "geojson": {
      "type": "Point",
      "coordinates": [8.8034, 53.0756]
    },
    "buffer": 100  
  },
  "limit": 200,
  "filters": {
    "category_group_ids": [160]
  } 
}'
POI Statistics
curl -X POST \
  http://129.206.7.157:5005/pois \
  -H 'Content-Type: application/json' \
  -d '{
  "request": "stats",
  "geometry": {
    "bbox": [
      [8.8034, 53.0756],
      [8.7834, 53.0456]
    ],
    "geojson": {
      "type": "Point",
      "coordinates": [8.8034, 53.0756]
    },
    "buffer": 100  
  }
}'
POI Categories as a list
curl -X POST \
  http://127.0.0.1:5000/pois \
  -H 'content-type: application/json' \
  -d '{
	"request": "list"
}'

More Repositories

1

openrouteservice

🌍 The open source route planner api with plenty of features.
Java
1,442
star
2

openrouteservice-py

🐍 The Python API to consume openrouteservice(s) painlessly!
Python
389
star
3

openrouteservice-app

πŸš™ The open source route planner app with plenty of features.
JavaScript
224
star
4

openrouteservice-js

πŸ“Œ The JavaScript API to consume openrouteservice(s) painlessly!
JavaScript
203
star
5

GIScene.js

3D WebGIS framework. Based on Three.js. Easy to learn and customize. For examples and API see:
JavaScript
116
star
6

oshdb

OpenStreetMap History Data Analysis Framework
Java
110
star
7

ors-map-client

Openrouteservice API web SPA client using VueJS, Vuetify and Vue2Leaflet
JavaScript
108
star
8

Leaflet.Heightgraph

Leaflet plugin to visualize height information and road attributes.
JavaScript
100
star
9

orstools-qgis-plugin

Plugin for QGIS with a set of tools to use openrouteservice APIΒ΄s, based on openstreetmap
Python
96
star
10

openrouteservice-r

🌐 query openrouteservice API from R
R
93
star
11

helios

HELIOS - the Heidelberg LiDAR Operations Simulator - is a software package for interactive real-time simulation and visualisation of terrestrial, mobile and airborne laser scan surveys written in Java.
Java
85
star
12

openrouteservice-examples

πŸ“š (Mostly) real-world examples and inspirations to use the full breadth of ORS services and clients
Jupyter Notebook
84
star
13

openrouteservice-docs

πŸ“ This repository stores the swagger specifications of the openrouteservice API. Browse to swagger for a detailed overview.
63
star
14

openelevationservice

πŸŒ„ A GeoJSON based service to query SRTM elevation for points/lines.
Python
63
star
15

openrouteservice-app-legacy

OpenRouteService is an online route planning application that is based on open source software, open data and open standards.
JavaScript
55
star
16

ohsome2label

Historical OpenStreetMap Objects to Machine Learning Training Samples
Python
48
star
17

ohsome-api

API for analysing OpenStreetMap history data
Java
44
star
18

OSM-realtime-update

πŸ•‘ OpenStreetMap Data Extracts - updated on the fly!
JavaScript
41
star
19

ohsome-quality-api

Data quality estimations for OpenStreetMap
Python
34
star
20

sketch-map-tool

Create re-digitizable paper maps for offline data collection in the field.
Python
32
star
21

openfuelservice

πŸš—β˜οΈπŸ’Έ The opensource vehicle fuel consumption, emission and cost calculator api
Python
17
star
22

ohsome-py

Python bindings for the ohsome API
Jupyter Notebook
17
star
23

vostok

VOSTOK, the Voxel Octree Solar Toolkit, is a C++ command-line tool to compute a detailed model of incoming solar radiation distribution on a patch of land, including structures like buildings and vegetation, represented by a 3D point cloud data set.
C++
15
star
24

osmatrix-client

OSMatrix is a web-based application to visualize characteristics of OpenStreetMap, which are usually not displayed in cartographic representations of the data.
Python
14
star
25

ohsome-r

This ohsome R package grants access to the power of the ohsome API from R.
R
11
star
26

measures-rest

A REST server to provide measures for geospatial datasets
Java
10
star
27

ohsome-examples

A curated list of examples of using the https://github.com/giscience/ohsome-api
Jupyter Notebook
9
star
28

osmgpxmapmatcher

Java
9
star
29

osm-vis-data

Data for OSMvis
8
star
30

osmgpxinclinecalculator

Tools for incline computation with OSM GPX files
Java
7
star
31

gis-training-resource-center

Io
7
star
32

ohsome-dashboard

Web Client for easy access to OSM History and Quality Analyses
JavaScript
7
star
33

ohsome-qgis-plugin

ohsome Qgis plugin
Python
6
star
34

global-urban-building-completeness-analysis

Code related to the paper entitled "Investigating completeness and inequalities in OpenStreetMap: spatio-temporal analysis of global urban building data"
Jupyter Notebook
6
star
35

socialmedia2traffic-api

SocialMedia2Traffic API
Python
6
star
36

osmatrix

JavaScript
5
star
37

ol-print-layout-control

An extension of openlayers Control. It Helps the user to define a map area that fits to the desired output page format and orientation.
TypeScript
5
star
38

ohsome-now-stats-frontend

This is the frontend application for the ohsomeNow stats.
TypeScript
5
star
39

ohsome-now-stats

The goal of this project is to quantify the changes that are happening to the OpenStreetMap (OSM) database every minute.
Jupyter Notebook
5
star
40

ohsome-now-stats-service

This is the REST service for the ohsomeNow stats.
Kotlin
4
star
41

Safer-Route

R
4
star
42

osm-bikeability

Bikeability index based on OpenStreetMap features for european urban areas
Python
4
star
43

Long-term-validation-of-inner-urban-mobility-metrics-derived-from-Twitter

Long-term validation of inner-urban mobility metrics derived from Twitter
Jupyter Notebook
4
star
44

osmalert

OSM Alert: ohsome Alert variant for ISEP 2023
Java
3
star
45

osm-transform

Custom data filtering and enrichment for OpenStreetMap PBF files for a better openrouteservice graph building
C++
3
star
46

openrouteservice-java

β˜• The Java API to consume openrouteservice(s) painlessly!
3
star
47

ohsome-quality-api-examples

Jupyter Notebook with examples on how to use the OQT API with Python.
Jupyter Notebook
3
star
48

osmgpxpreprocessor

Pre-processing tools for incline computation with OSM GPX files
Java
3
star
49

green-15min-city

HeiGIT's OSS4SDG hackathon submission
HTML
3
star
50

mapswipe-analytics-client

JavaScript
2
star
51

POI-data-matching

Jupyter Notebook
2
star
52

mapswipe-tutorial

JavaScript
2
star
53

ohsome-api-dockerized

Dockerized Version of the ohsome-api
Dockerfile
2
star
54

healthcare-access-idai

Material on an analysis of healthcare access in Mozambique with the impact of cyclone Idai
R
2
star
55

osmgpxfilter

Java
2
star
56

heigit-disaster-portal

Python
2
star
57

OSM_Events

Supplementary Data and Visualizations for the Paper β€œAn Analysis of the Spatial and Temporal Distribution of Large-Scale Data Production Events in OpenStreetMap”
Python
2
star
58

mapswipe-live

JavaScript
1
star
59

giscience2023

Webpage for the Workshop given at the GIScience Conference 2023
SCSS
1
star
60

nairobi-uber-access

HTML
1
star
61

measures-rest-oshdb-docker

Scripts for starting measures for geospatial datasets in docker container, using the OSHDB
Shell
1
star
62

openpoiservice-docker

openpoiservice-docker
Shell
1
star
63

wegovnow

Embeddable Geo-Spatial Data Repository - WeGovNow Data Quality Management System
C
1
star
64

mapswipe-processing

Python
1
star
65

OSMlanduse-BFM

Jupyter Notebook
1
star
66

pybossa-mapswipe-2

HTML
1
star
67

vue2-leaflet-height-graph

Vue2Leaflet plugin to wrap Leaflet.Heightgraph control for Vue applications
JavaScript
1
star
68

mapswipe-analytics-backend

backend workers to generate and enrich mapswipe data and statistics
Python
1
star
69

shop-completeness

HTML
1
star
70

badges

Collection of badges for indicating the state of a project
Shell
1
star
71

osmatrix-processing

No longer maintained: Processing of osmatrix in postgreSQL
Java
1
star
72

hot-tm-critical-numbers

A GIScience Heidelberg project for for the HOT Tasking Manager.
Python
1
star
73

openrouteservice-schema

Repository for schemas used in the ORS
1
star
74

osm-measure-repository

A repository of OpenStreetMap (OSM) measures
Java
1
star
75

measures-rest-sparql

A SPARQL endpoint for the Measures REST OSHDB App framework.
Python
1
star
76

ai-assisted-osm-mapping-stats

Find out the global scale and evolution of AI-assisted mapping in OpenStreetMap
Jupyter Notebook
1
star
77

Jakarta_Thesis_Klipper

Flood Impact Assessment on Road Network and Healthcare Access
Python
1
star
78

ohsome-js-utils

This library contains JavaScript functions to help clients to use the Ohsome-Api for analyzing historical OpenStreetMap data.
TypeScript
1
star
79

ors-config-migration

Tool for migrating ors-config.json files to ors-config.yml
Python
1
star
80

ors-netascore-workshop-agile-24

Workshop at AGILE 2024
CSS
1
star
81

openrouteservice-workshop-r

Repo to run an openrouteserice workshop via R on binder
HTML
1
star