{ "info": { "author": "Timothy Ellersiek", "author_email": "timothy@openrouteservice.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Build Tools" ], "description": "# Openpoiservice \n\n[![Build Status](https://travis-ci.org/GIScience/openpoiservice.svg?branch=master)](https://travis-ci.org/GIScience/openpoiservice)\n\nOpenpoiservice (ops) is a flask application which hosts a highly customizable points of interest database derived from \nOpenStreetMap.org data and thereby **exploits** it's notion of tags...\n\n> OpenStreetMap [tags](https://wiki.openstreetmap.org/wiki/Tags) consisting of a key and value describe specific features of \n> map elements (nodes, ways, or relations) or changesets. Both items are free format text fields, but often represent numeric \n> or other structured items. \n\nThis service consumes OSM tags on nodes, ways and relations by grouping them into predefined categories. \nIf it picks up an OSM object tagged with one of the osm keys defined in `categories.yml` it will import this \npoint of interest with specific additional tags which may be defined in `ops_settings.yml`. Any additional tag, \nfor instance `wheelchair` or `smoking` may then be used to query the service via the API after import.\n\nFor instance, if you want to request all pois accessible by wheelchair within a geometry, you could add then add \n`wheelchair: ['yes', 'dedicated]` in `filters` within the body of your HTTP POST request. \n\nYou may pass 3 different types of geometry within the request to the database. Currently \"Point\" and \"LineString\" with\na corresponding and buffer are supported as well as a polygon. Points of interest will be returned within the given geometry.\n\nYou can control the maximum size of geometries and further restrictions in the settings file of this service.\n\n#### Import Process \n\nThe osm file(s) to be imported are parsed several times to extract points of interest from relations (osm_type 3), \nways (osm_type 2) and nodes (osm_type 1) in order. Which type the specific point of interest originated from will be \nreturned in the response - this will help you find the object directly on [OpenStreetMap.org](OpenStreetMap.org). \n\n## Installation\n\nYou can either run **openpoiservice** on your host machine in a virtual environment or simply with docker. The Dockerfile \nprovided installs a WSGI server (gunicorn) which starts the flask service on port 5000. \n\n### Technical specs for storing and importing OSM files\n\n##### Python version\n\nAs this service makes use of the python collections library, in particular the notion of deque's and its functions\nit only supports python 3.5 and greater.\n\n##### Database\nThis application uses a psql/postgis setup for storing the points of interest. We highly recommend [using this](https://github.com/kartoza/docker-postgis) \ndocker container.\n\n##### Importer\nPlease consider the following technical requirements for parsing & importing osm files.\n\n| Region | Memory | \n| ------------- |:-------------:|\n| Germany | 8 GB |\n| Europe | 32 GB | \n| Planet | 128 GB | \n\n**Note:** Openpoiservice will import any osm pbf file located in the osm folder or subdirectory within. \nThis way you can split the planet file into smaller regions (e.g. download from Geofabrik, scraper script for the download\nlinks to be found in the osm folder) and use a *smaller* instance to import the global data set (as long as\nthe OSM files don't exceed 5 GB of disk space, 16 GB of memory will suffice to import the entire planet).\n\n### Run as Docker Container (Flask + Gunicorn)\n\nMake your necessary changes to the settings in the file `ops_settings_docker.yml`. This file will be copied to the docker container.\nIf you are planning to import a different osm file, please download it to the `osm folder` (any folder within will be scanned\nfor osm files) as this will be a shared volume. \n\nAfterwards run:\n\n\n```sh\n$ docker-compose up -d -f /path/to/docker-compose.yml\n```\n\nOnce the container is built you can either, create the empty database:\n\n```sh\n$ docker exec -it container_name /ops_venv/bin/python manage.py create_db\n```\n\nDelete the database:\n\n```sh\n$ docker exec -it container_name /ops_venv/bin/python manage.py drop_db\n```\n\nOr import the OSM data:\n\n```sh\n$ docker exec -it container_name /ops_venv/bin/python manage.py import_data\n```\n\n\n### Run in a Virtual Environment\n\n1. Create and activate a virtualenv\n2. This repository uses [imposm.parser](https://imposm.org/docs/imposm.parser/latest/index.html) to parse the \nOpenStreetMap data. To this end, **make sure** `google's protobuf` is installed on your system:\n\n- **Ubuntu (16.04 and earlier, supported on 17.10)**: most likely you will have to install protobuf [from source](https://github.com/google/protobuf/blob/master/src/README.md) if \n[https://imposm.org/docs/imposm.parser/latest/install.html#requirements](https://imposm.org/docs/imposm.parser/latest/install.html#requirements) doesn't\ndo the job.\n- **OS X** Using homebrew` on OS X `brew install protobuf` will suffice.\n3. Afterwards you can install the necessary requirements via pipwith `pip install -r requirements.txt`\n\n\n### Prepare settings.yml\n\nUpdate `openpoiservice/server/ops_settings.yml` with your necessary settings and then run one of the following\ncommands.\n\n[\n```sh\n$ export APP_SETTINGS=\"openpoiservice.server.config.ProductionConfig|DevelopmentConfig\"\n```\n]\n\n\n### Create the POI DB\n\n```sh\n$ python manage.py create_db\n```\n### Drop the POI DB\n\n```sh\n$ python manage.py drop_db\n```\n\n### Parse and import OSM data\n\n```sh\n$ python manage.py import_data\n```\n\n### Run the Application with Flask-Werkzeug\n\n```sh\n$ python manage.py run\n```\n\nPer default you can access the application at the address [http://localhost:5000/](http://localhost:5000/)\n\n> Want to specify a different port?\n\n> ```sh\n> $ python manage.py run -h 0.0.0.0 -p 8080\n> ```\n\n### Tests\n\n```sh\n$ export TESTING=\"True\" && python manage.py test\n```\n\n\n### Category IDs and their configuration\n\n`openpoiservice/server/categories/categories.yml` is a list of (**note:** not all!) OpenStreetMap tags with arbitrary category IDs. \nIf you keep the structure as follows, you can manipulate this list as you wish.\n\n ```yaml\n transport:\n id: 580\n children:\n aeroway:\n aerodrome: 581 \n aeroport: 582 \n helipad: 598 \n heliport: 599 \n amenity:\n bicycle_parking: 583 \n\n sustenance:\n id: 560 \n children:\n amenity:\n bar: 561 \n bbq: 562 \n ...\n ```\n\n Openpoiservice uses this mapping while it imports pois from the OpenStreetMap data and assigns the custom category IDs\n accordingly.\n\n`column_mappings` in `openpoiservice/server/ops_settings.yml` controls which OSM information will be considered in the database and also if \nthese may be queried by the user via the API , e.g.\n\n```py\nwheelchair:\n\nsmoking:\n\nfees:\n```\n\nFor instance means that the OpenStreetMap tag [wheelchair](https://wiki.openstreetmap.org/wiki/Key:wheelchair) will be considered\nduring import and save to the database. A user may then add a list of common values in the filters object `wheelchair: ['yes', 'dedicated', ...]` \nwhich correspond to the OSM common values of the tag itself, e.g. \n[https://wiki.openstreetmap.org/wiki/Key:wheelchair](https://wiki.openstreetmap.org/wiki/Key:wheelchair).\n\n### API Documentation\n\nThe documentation for this flask service is provided via [flasgger](https://github.com/rochacbruno/flasgger) and can be\naccessed via `http://localhost:5000/apidocs/`.\n\nGenerally you have three different request types `pois`, `stats` and\n`list`.\n\nUsing `request=pois` in the POST body will return a GeoJSON FeatureCollection\nin your specified bounding box or geometry. \n\nUsing `request=stats` will do the same but group by the categories, ultimately\nreturning a JSON object with the absolute numbers of pois of a certain group. \n\nFinally, `request=list` will return a JSON object generated from \n`openpoiservice/server/categories/categories.yml`.\n\n### Examples\n\n##### POIS around a buffered point\n\n```sh\ncurl -X POST \\\n http://localhost:5000/pois \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"request\": \"pois\",\n \"geometry\": {\n \"bbox\": [\n [8.8034, 53.0756],\n [8.7834, 53.0456]\n ],\n \"geojson\": {\n \"type\": \"Point\",\n \"coordinates\": [8.8034, 53.0756]\n },\n \"buffer\": 250 \n }\n}'\n```\n\n##### POIs of given categories\n```sh\ncurl -X POST \\\n http://localhost:5000/pois \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"request\": \"pois\",\n \"geometry\": {\n \"bbox\": [\n [8.8034, 53.0756],\n [8.7834, 53.0456]\n ],\n \"geojson\": {\n \"type\": \"Point\",\n \"coordinates\": [8.8034, 53.0756]\n },\n \"buffer\": 100 \n },\n \"limit\": 200,\n \"filters\": {\n \"category_ids\": [180, 245]\n } \n}'\n```\n\n##### POIs of given category groups\n\n```sh\ncurl -X POST \\\n http://localhost:5000/pois \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"request\": \"pois\",\n \"geometry\": {\n \"bbox\": [\n [8.8034, 53.0756],\n [8.7834, 53.0456]\n ],\n \"geojson\": {\n \"type\": \"Point\",\n \"coordinates\": [8.8034, 53.0756]\n },\n \"buffer\": 100 \n },\n \"limit\": 200,\n \"filters\": {\n \"category_group_ids\": [160]\n } \n}'\n```\n\n##### POI Statistics\n```sh\ncurl -X POST \\\n http://129.206.7.157:5005/pois \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"request\": \"stats\",\n \"geometry\": {\n \"bbox\": [\n [8.8034, 53.0756],\n [8.7834, 53.0456]\n ],\n \"geojson\": {\n \"type\": \"Point\",\n \"coordinates\": [8.8034, 53.0756]\n },\n \"buffer\": 100 \n }\n}'\n```\n\n##### POI Categories as a list\n\n```sh\ncurl -X POST \\\n http://127.0.0.1:5000/pois \\\n -H 'content-type: application/json' \\\n -d '{\n\t\"request\": \"list\"\n}'\n```\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/GIScience/openpoiservice", "keywords": "OSM ORS openrouteservice openstreetmap POI points of interest", "license": "", "maintainer": "", "maintainer_email": "", "name": "openpoiservice", "package_url": "https://pypi.org/project/openpoiservice/", "platform": "", "project_url": "https://pypi.org/project/openpoiservice/", "project_urls": { "Bug Reports": "https://github.com/GIScience/openpoiservice/issues", "Homepage": "https://github.com/GIScience/openpoiservice", "Source": "https://github.com/GIScience/openpoiservice" }, "release_url": "https://pypi.org/project/openpoiservice/0.1.7/", "requires_dist": null, "requires_python": "", "summary": "POI service consuming OpenStreetMap data", "version": "0.1.7" }, "last_serial": 4144356, "releases": { "0.1.7": [ { "comment_text": "", "digests": { "md5": "c736f819ca04d1e5c77f675ad6b49bb3", "sha256": "157000b8f1031cd070a1fe1f9046de9d09390f2dd6ee548e023c90c6310075a9" }, "downloads": -1, "filename": "openpoiservice-0.1.7-py3-none-any.whl", "has_sig": false, "md5_digest": "c736f819ca04d1e5c77f675ad6b49bb3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27469, "upload_time": "2018-08-07T14:38:32", "url": "https://files.pythonhosted.org/packages/99/4e/e3f64ff2e2abab5cab63ece6402e32c0319365dece4fa6d181f55964020d/openpoiservice-0.1.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c7c8f2477f2f266ad02e6b795dab4e1", "sha256": "e81d3f4d1c3dd37dfcc177ee8243056676a1db0a088d1b35344240c3f23746f2" }, "downloads": -1, "filename": "openpoiservice-0.1.7.tar.gz", "has_sig": false, "md5_digest": "8c7c8f2477f2f266ad02e6b795dab4e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24837, "upload_time": "2018-08-07T14:38:33", "url": "https://files.pythonhosted.org/packages/35/74/64f4c8e32902a617582e3b05bfb4d607a49f45fc79a48668902838d7e2da/openpoiservice-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c736f819ca04d1e5c77f675ad6b49bb3", "sha256": "157000b8f1031cd070a1fe1f9046de9d09390f2dd6ee548e023c90c6310075a9" }, "downloads": -1, "filename": "openpoiservice-0.1.7-py3-none-any.whl", "has_sig": false, "md5_digest": "c736f819ca04d1e5c77f675ad6b49bb3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27469, "upload_time": "2018-08-07T14:38:32", "url": "https://files.pythonhosted.org/packages/99/4e/e3f64ff2e2abab5cab63ece6402e32c0319365dece4fa6d181f55964020d/openpoiservice-0.1.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c7c8f2477f2f266ad02e6b795dab4e1", "sha256": "e81d3f4d1c3dd37dfcc177ee8243056676a1db0a088d1b35344240c3f23746f2" }, "downloads": -1, "filename": "openpoiservice-0.1.7.tar.gz", "has_sig": false, "md5_digest": "8c7c8f2477f2f266ad02e6b795dab4e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24837, "upload_time": "2018-08-07T14:38:33", "url": "https://files.pythonhosted.org/packages/35/74/64f4c8e32902a617582e3b05bfb4d607a49f45fc79a48668902838d7e2da/openpoiservice-0.1.7.tar.gz" } ] }