diff --git a/.github/workflows/ci-production.yml b/.github/workflows/ci-production.yml index 8216d075..6a4c7498 100644 --- a/.github/workflows/ci-production.yml +++ b/.github/workflows/ci-production.yml @@ -14,60 +14,55 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.8", "pypy3.9" ] - poetry-version: [ "latest" ] - os: [ ubuntu-20.04, macos-latest, windows-latest ] + config: + - python-version: '3.11' + tox: py311 + poetry-version: [ "1.8.2" ] + os: [ ubuntu-22.04, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} - name: Python ${{ matrix.python-version }} / Poetry ${{ matrix.poetry-version }} / ${{ matrix.os }} + name: Python ${{ matrix.config.python-version }} / Poetry ${{ matrix.poetry-version }} / ${{ matrix.os }} defaults: run: shell: bash steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - name: Install poetry + run: pipx install poetry + - name: Install Python ${{ matrix.config.python-version }} + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - - name: Update pip - run: | - python -m pip install --upgrade pip - - name: Run Poetry action - uses: abatilo/actions-poetry@v2 - with: - poetry-version: ${{ matrix.poetry-version }} - - name: View poetry --version - run: poetry --version - - name: Install dependencies - run: poetry install - - name: Run tests - run: poetry run pytest - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + python-version: ${{ matrix.config.python-version }} + cache: 'poetry' + - name: Install packages + run: poetry install --no-root + - name: Load cached tox + uses: actions/cache@v3 with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: unittests - env_vars: OS,PYTHON - name: codecov-umbrella - fail_ci_if_error: true - verbose: true + path: .tox + key: tox-${{ matrix.os }}-poetry-${{ matrix.poetry-version }}-python-${{ matrix.config.python-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Setup API Key + env: + ORS_API_KEY: ${{ secrets.ORS_API_KEY }} + run: printf "[ORS]\napiKey = $ORS_API_KEY\n" > tests-config.ini + - name: Run tox + run: | + poetry run tox -e pytest-${{ matrix.config.tox }} + build-and-publish: name: Build and publish Python distributions 📦 to PyPI and TestPyPI runs-on: ubuntu-20.04 - needs: - - pytest + needs: pytest steps: - - uses: actions/checkout@v2 - - name: Set up base Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Python Poetry Action - uses: abatilo/actions-poetry@v2 + - uses: actions/checkout@v4 + - name: Install poetry + run: pipx install poetry + - name: Install Python ${{ matrix.config.python-version }} + uses: actions/setup-python@v5 with: - poetry-version: latest + python-version: ${{ matrix.config.python-version }} + cache: 'poetry' - name: Publish distribution 📦 with test.pypi.org if: startsWith(github.ref, 'refs/tags/v') run: | diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 68419347..88b637ad 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -1,78 +1,52 @@ name: tests on: - pull_request: - branches: '**' + push: + branches: ['**'] jobs: - lint: - runs-on: ubuntu-20.04 - steps: - - name: checkout - uses: actions/checkout@v2 - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - uses: pre-commit/action@v3.0.0 - with: - extra_args: --all-files --show-diff-on-failure pytest: - needs: - - lint strategy: fail-fast: false matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.8", "pypy3.9" ] - poetry-version: [ "1.5.1" ] - os: [ ubuntu-20.04, macos-latest, windows-latest ] + config: + - python-version: '3.8' + tox: py38 + - python-version: '3.9' + tox: py39 + - python-version: '3.10' + tox: py310 + - python-version: '3.11' + tox: py311 + poetry-version: [ "1.8.2" ] + os: [ ubuntu-22.04, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} - name: Python ${{ matrix.python-version }} / Poetry ${{ matrix.poetry-version }} / ${{ matrix.os }} + name: Python ${{ matrix.config.python-version }} / Poetry ${{ matrix.poetry-version }} / ${{ matrix.os }} defaults: run: shell: bash steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - name: Install poetry + run: pipx install poetry + - name: Install Python ${{ matrix.config.python-version }} + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - - name: Select the cache folder - id: cache-folder - run: | - if [ ${{ matrix.os }} == 'ubuntu-20.04' ]; then - CACHE_FOLDER="/home/runner/.cache/pypoetry" - elif [ ${{ matrix.os }} == 'macos-latest' ]; then - CACHE_FOLDER="/Users/runner/Library/Caches/pypoetry" - elif [ ${{ matrix.os }} == 'windows-latest' ]; then - CACHE_FOLDER="C:\Users\runneradmin\AppData\Local\pypoetry\Cache" - fi - echo "Cache folder is $CACHE_FOLDER" - echo "folder=$CACHE_FOLDER" >> "$GITHUB_OUTPUT" - - name: Cache Poetry cache + python-version: ${{ matrix.config.python-version }} + cache: 'poetry' + - name: Install packages + run: poetry install --no-root + - name: Load cached tox uses: actions/cache@v3 with: - path: ${{ steps.cache-folder.outputs.folder }} - key: poetry-cache-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }} - - name: Run Poetry action - uses: abatilo/actions-poetry@v2 - with: - poetry-version: ${{ matrix.poetry-version }} - - name: View poetry --version - run: poetry --version - - name: Install dependencies - run: poetry install - - name: Run tests - run: poetry run pytest - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: unittests - env_vars: OS,PYTHON - name: codecov-umbrella - fail_ci_if_error: true - verbose: true + path: .tox + key: tox-${{ matrix.os }}-poetry-${{ matrix.poetry-version }}-python-${{ matrix.config.python-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Setup API Key + env: + ORS_API_KEY: ${{ secrets.ORS_API_KEY }} + run: printf "[ORS]\napiKey = $ORS_API_KEY\n" > tests-config.ini + - name: Run tox + run: | + poetry run tox -e pytest-${{ matrix.config.tox }} diff --git a/.gitignore b/.gitignore index c394d5f7..b27e6160 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,82 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ .tox/ -.venv* -.env* .coverage -**/.ipynb_checkpoints/ -*.geojson -*.pyc -*.in -*egg-info/ -dist/ -build/ -/docs/build -test.py - -#IDE -.spyproject/ -.idea/ - -cover/ -conda/ -*coverage.xml -/setup.py -/requirements.txt +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints + +# IDE +.vscode +.idea + +# API Key +openrouteservice-py/tests-config.ini + +# node_modules +openrouteservice-js/node_modules +node_modules/ + +# Vitepress +.vitepress/cache + +# Generated and used during building +client_version.txt +openrouteservice_ignore_paths.yaml diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore new file mode 100644 index 00000000..c5fa491b --- /dev/null +++ b/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION new file mode 100644 index 00000000..27dedc56 --- /dev/null +++ b/.swagger-codegen/VERSION @@ -0,0 +1 @@ +3.0.53-SNAPSHOT \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..dd6c4450 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "3.2" + - "3.3" + - "3.4" + - "3.5" + #- "3.5-dev" # 3.5 development branch + #- "nightly" # points to the latest development branch e.g. 3.6-dev +# command to install dependencies +install: "pip install -r requirements.txt" +# command to run tests +script: nosetests diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 6f3ab212..00000000 --- a/AUTHORS +++ /dev/null @@ -1,20 +0,0 @@ -# This is the official list of openrouteservice-py authors -# for copyright purposes. This file is distinct from the CONTRIBUTORS files. -# See the latter for an explanation. - -# Names should be added to this file as -# Name or Organization -# The email address is not required for organizations. - -# Please keep the list sorted. - -# The work is based on Python Client for Google Maps Services: -# https://github.com/googlemaps/google-maps-services-python -# Following authors were registered: - -Google Inc. - -# Modified to fit ORS needs by - -Julian Psotta -Nils Nolde diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 9ab8a608..00000000 --- a/CHANGELOG +++ /dev/null @@ -1,58 +0,0 @@ -# Unreleased - -- add 'intersections'-parameter to isochrones - -## 2.2.0 - -- restrict optimize_waypoints parameter to not trigger when options or 'shortest' is used -- Add optimize_waypoints option to directions for simple TSP -- get rid of validators, too maintenance-heavy - -## 2.1.0 - -- fix minor problems, apply PEP lint, add some tests -- Add optimization endpoint - -# 2.0.0 - -- implement all backend changes from moving to openrouteservice v5 -- now all parameters are named like their backend equivalents, while keeping the old ors-py parameter names for backwards compatibility, but with deprecation warnings -- validator validates ALL parameters -- added a Client.req property, returning the actual `requests` request - -### v1.1.8 - -- make dependencies more sensible (#32) - -### v1.1.7 - -- fix boundary.country for pelias_search (#30) -- change isochrone defaults (#31) - -### v1.1.6 - -- fix boolean parameters (#28) - -### v1.1.0 - -- fix decoding of 2D polylines -- add support for true booleans - -# v1.0 - -- add Pelias Autocomplete -- add elevation endpoint -- proper parameter validation via Cerberus - -## v0.4 - -- add Pelias geocoding endpoints - -## v0.3 - -- add options object to directions API - -## v0.2 - -- Integrate openpoiservice (#1) -- add dry_run diff --git a/CONTRIBUTORS b/CONTRIBUTORS deleted file mode 100644 index eded1a8d..00000000 --- a/CONTRIBUTORS +++ /dev/null @@ -1,21 +0,0 @@ -# This is the official list of people who have contributed to the project. The -# copyright is held by those individuals or organizations in the AUTHORS file. -# -# Names should be added to this file like so: -# Name - -# Please keep the list sorted by first name. - -Julian Psotta -Nils Nolde - -# The following people contributed to the original Python Client for Google Maps Services: - -Brett Morgan -Chris Broadfoot -Dave Holmes -Luke Mahe -Mark McDonald -Sam Thorogood -Sean Wohltman -Stephen McDonald diff --git a/README.md b/README.md new file mode 100644 index 00000000..ad651576 --- /dev/null +++ b/README.md @@ -0,0 +1,164 @@ +# openrouteservice-py +> [!IMPORTANT] +> The new version of `openrouteservice-py` is generated using swagger-codegen and is **not compatible** with the old SDK. However the methods of the old client are still available and marked as deprecated in the new SDK during a transition phase. +> +> Please migrate your project to the new SDK to be able to access all new features of the openrouteservice! + +The openrouteservice library gives you painless access to the [openrouteservice](https://openrouteservice.org) (ORS) routing API's. This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) using our latest API specifications. + +| API Version | Package version | Build package | +| -------------- | ------------------ | ------------------ | +| 8.2.0 | 8.2.0 | io.swagger.codegen.v3.generators.python.PythonClientCodegen | + +For further details, please visit: +- our [homepage](https://openrouteservice.org) +- [ORS API documentation](https://openrouteservice.org/documentation/) + +For support, please ask our [forum](https://ask.openrouteservice.org/c/sdks). +By using this library, you agree to the ORS [terms and conditions](https://openrouteservice.org/terms-of-service/). + +## Requirements. + +Python 3.8+ + +## Installation & Usage +### pip install + +If the python package is hosted on Github, you can install directly from Github + +```sh +pip install openrouteservice +``` + +Then import the package: +```python +import openrouteservice +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import openrouteservice +``` + +## Usage +Please follow the [installation procedure](#installation--usage) before running the examples: + +### Examples +These examples show common usages of this library. +- [Avoid construction sites dynamically](https://openrouteservice.org/example-avoid-obstacles-while-routing/) +- [Dieselgate Routing](https://openrouteservice.org/dieselgate-avoid-berlin-banned-diesel-streets/) +- [Route optimization of pub crawl](https://openrouteservice.org/example-optimize-pub-crawl-with-ors/) +- [Routing optimization in humanitarian context](https://openrouteservice.org/disaster-optimization/) + +### Basic example +```python +import openrouteservice as ors +from pprint import pprint + +# create an instance of the API class +directionsApi = ors.DirectionsServiceApi( + ors.apiClient(apiKey="YOUR_API_KEY") # set your api key here +) + +# create request body +body = ors.DirectionsServiceBody( + coordinates=[[8.34234,48.23424],[8.34423,48.26424]] +) + +profile = 'driving-car' + +try: + routes = directionsApi.get_geo_json_route(body, profile) + pprint(routes) +except ors.rest.ApiException as e: + print("Exception when calling DirectionsServiceApi->get_geo_json_route: %s\n" % e) +``` + +### Local ORS instance +```python +import openrouteservice as ors +from pprint import pprint + +isochronesApi = ors.IsochronesServiceApi( + ors.apiClient(host="http://localhost:8080/ors") # set host to your local instance +) + +body = ors.IsochronesProfileBody( + locations=[[8.681495,49.41461],[8.686507,49.41943]], + range=[300] +) +profile = 'driving-car' # Specifies the route profile. + +try: + api_response = isochronesApi.get_default_isochrones(body, profile) + pprint(api_response) +except ors.rest.ApiException as e: + print("Exception when calling IsochronesServiceApi->get_default_isochrones: %s\n" % e) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.openrouteservice.org* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DirectionsServiceApi* | [**get_geo_json_route**](docs/DirectionsServiceApi.md#get_geo_json_route) | **POST** /v2/directions/{profile}/geojson | Directions Service GeoJSON +*DirectionsServiceApi* | [**get_json_route**](docs/DirectionsServiceApi.md#get_json_route) | **POST** /v2/directions/{profile}/json | Directions Service JSON +*ElevationApi* | [**elevation_line_post**](docs/ElevationApi.md#elevation_line_post) | **POST** /elevation/line | Elevation Line Service +*ElevationApi* | [**elevation_point_get**](docs/ElevationApi.md#elevation_point_get) | **GET** /elevation/point | Elevation Point Service +*ElevationApi* | [**elevation_point_post**](docs/ElevationApi.md#elevation_point_post) | **POST** /elevation/point | Elevation Point Service +*GeocodeApi* | [**geocode_autocomplete_get**](docs/GeocodeApi.md#geocode_autocomplete_get) | **GET** /geocode/autocomplete | Geocode Autocomplete Service +*GeocodeApi* | [**geocode_reverse_get**](docs/GeocodeApi.md#geocode_reverse_get) | **GET** /geocode/reverse | Reverse Geocode Service +*GeocodeApi* | [**geocode_search_get**](docs/GeocodeApi.md#geocode_search_get) | **GET** /geocode/search | Forward Geocode Service +*GeocodeApi* | [**geocode_search_structured_get**](docs/GeocodeApi.md#geocode_search_structured_get) | **GET** /geocode/search/structured | Structured Forward Geocode Service (beta) +*IsochronesServiceApi* | [**get_default_isochrones**](docs/IsochronesServiceApi.md#get_default_isochrones) | **POST** /v2/isochrones/{profile} | Isochrones Service +*MatrixServiceApi* | [**get_default1**](docs/MatrixServiceApi.md#get_default1) | **POST** /v2/matrix/{profile} | Matrix Service +*OptimizationApi* | [**optimization_post**](docs/OptimizationApi.md#optimization_post) | **POST** /optimization | Optimization Service +*PoisApi* | [**pois_post**](docs/PoisApi.md#pois_post) | **POST** /pois | Pois Service +*SnappingServiceApi* | [**get_default**](docs/SnappingServiceApi.md#get_default) | **POST** /v2/snap/{profile} | Snapping Service +*SnappingServiceApi* | [**get_geo_json_snapping**](docs/SnappingServiceApi.md#get_geo_json_snapping) | **POST** /v2/snap/{profile}/geojson | Snapping Service GeoJSON +*SnappingServiceApi* | [**get_json_snapping**](docs/SnappingServiceApi.md#get_json_snapping) | **POST** /v2/snap/{profile}/json | Snapping Service JSON + +## Documentation For Models + + - [AlternativeRoutes](docs/AlternativeRoutes.md) + - [DirectionsServiceBody](docs/DirectionsServiceBody.md) + - [ElevationLineBody](docs/ElevationLineBody.md) + - [ElevationPointBody](docs/ElevationPointBody.md) + - [IsochronesProfileBody](docs/IsochronesProfileBody.md) + - [JSONResponse](docs/JSONResponse.md) + - [MatrixProfileBody](docs/MatrixProfileBody.md) + - [OpenpoiservicePoiRequest](docs/OpenpoiservicePoiRequest.md) + - [OptimizationBody](docs/OptimizationBody.md) + - [OptimizationBreaks](docs/OptimizationBreaks.md) + - [OptimizationCosts](docs/OptimizationCosts.md) + - [OptimizationJobs](docs/OptimizationJobs.md) + - [OptimizationMatrices](docs/OptimizationMatrices.md) + - [OptimizationMatricesCyclingelectric](docs/OptimizationMatricesCyclingelectric.md) + - [OptimizationOptions](docs/OptimizationOptions.md) + - [OptimizationSteps](docs/OptimizationSteps.md) + - [OptimizationVehicles](docs/OptimizationVehicles.md) + - [PoisFilters](docs/PoisFilters.md) + - [PoisGeometry](docs/PoisGeometry.md) + - [ProfileGeojsonBody](docs/ProfileGeojsonBody.md) + - [ProfileJsonBody](docs/ProfileJsonBody.md) + - [ProfileParameters](docs/ProfileParameters.md) + - [ProfileParametersRestrictions](docs/ProfileParametersRestrictions.md) + - [ProfileWeightings](docs/ProfileWeightings.md) + - [RoundTripRouteOptions](docs/RoundTripRouteOptions.md) + - [RouteOptions](docs/RouteOptions.md) + - [RouteOptionsAvoidPolygons](docs/RouteOptionsAvoidPolygons.md) + - [SnapProfileBody](docs/SnapProfileBody.md) + +## Author + +support@smartmobility.heigit.org diff --git a/README.rst b/README.rst deleted file mode 100644 index 6359d901..00000000 --- a/README.rst +++ /dev/null @@ -1,238 +0,0 @@ -.. image:: https://github.com/GIScience/openrouteservice-py/workflows/tests/badge.svg - :target: https://github.com/GIScience/openrouteservice-py/actions - :alt: Build status - -.. image:: https://codecov.io/gh/GIScience/openrouteservice-py/branch/master/graph/badge.svg?token=QqGC8XfCiI - :target: https://codecov.io/gh/GIScience/openrouteservice-py - :alt: Codecov coverage - -.. image:: https://readthedocs.org/projects/openrouteservice-py/badge/?version=latest - :target: http://openrouteservice-py.readthedocs.io/en/latest/?badge=latest - :alt: Documentation Status - -.. image:: https://badge.fury.io/py/openrouteservice.svg - :target: https://badge.fury.io/py/openrouteservice - :alt: PyPI version - -.. image:: https://mybinder.org/badge_logo.svg - :target: https://mybinder.org/v2/gh/GIScience/openrouteservice-py/master?filepath=examples%2Fbasic_example.ipynb - :alt: MyBinder - -Quickstart -================================================== - -Description --------------------------------------------------- -The openrouteservice library gives you painless access to the openrouteservice_ (ORS) routing API's. -It performs requests against our API's for - -- directions_ -- isochrones_ -- `matrix routing calculations`_ -- places_ -- elevation_ -- `Pelias geocoding`_ -- `Pelias reverse geocoding`_ -- `Pelias structured geocoding`_ -- `Pelias autocomplete`_ -- Optimization_ - -For further details, please visit: - -- homepage_ -- `ORS API documentation`_ -- `openrouteservice-py documentation`_ - -We also have a repo with a few useful examples here_. - -For support, please ask our forum_. - -By using this library, you agree to the ORS `terms and conditions`_. - -.. _openrouteservice: https://openrouteservice.org -.. _homepage: https://openrouteservice.org -.. _`ORS API documentation`: https://openrouteservice.org/documentation/ -.. _`openrouteservice-py documentation`: http://openrouteservice-py.readthedocs.io/en/latest/ -.. _directions: https://openrouteservice.org/documentation/#/reference/directions/directions/directions-service -.. _`Pelias geocoding`: https://github.com/pelias/documentation/blob/master/search.md#available-search-parameters -.. _`Pelias reverse geocoding`: https://github.com/pelias/documentation/blob/master/reverse.md#reverse-geocoding-parameters -.. _`Pelias structured geocoding`: https://github.com/pelias/documentation/blob/master/structured-geocoding.md -.. _`Pelias autocomplete`: https://github.com/pelias/documentation/blob/master/autocomplete.md -.. _isochrones: https://openrouteservice.org/documentation/#/reference/isochrones/isochrones/isochrones-service -.. _elevation: https://github.com/GIScience/openelevationservice/ -.. _`reverse geocoding`: https://openrouteservice.org/documentation/#/reference/geocoding/geocoding/geocoding-service -.. _`matrix routing calculations`: https://openrouteservice.org/documentation/#/reference/matrix/matrix/matrix-service-(post) -.. _places: https://github.com/GIScience/openpoiservice -.. _Optimization: https://github.com/VROOM-Project/vroom/blob/master/docs/API.md -.. _here: https://github.com/GIScience/openrouteservice-examples/tree/master/python -.. _`terms and conditions`: https://openrouteservice.org/terms-of-service/ -.. _forum: https://ask.openrouteservice.org/c/sdks - -Requirements ------------------------------ -openrouteservice-py is tested against Python 3.6, 3.7, 3.8 and 3.9, and PyPy3.6 and PyPy3.7. - -For setting up a testing environment, install **poetry** first. - -For Linux and osx:: - - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - - -For windows:: - - (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python - - -Then create a venv and install the dependencies with poetry:: - - python -m venv .venv && source .venv/bin/activate - poetry install -vv - -Installation ------------------------------- -To install from PyPI, simply use pip:: - - pip install openrouteservice - -To install the latest and greatest from source:: - - pip install git+git://github.com/GIScience/openrouteservice-py@development - - - -Testing ---------------------------------- -If you want to run the unit tests, see Requirements_. ``cd`` to the library directory and run:: - - pytest -v - -``-v`` flag for verbose output (recommended). - - -Usage ---------------------------------- - -For an interactive Jupyter notebook have a look on `mybinder.org `_. - -Basic example -^^^^^^^^^^^^^^^^^^^^ -.. code:: python - - import openrouteservice - - coords = ((8.34234,48.23424),(8.34423,48.26424)) - - client = openrouteservice.Client(key='') # Specify your personal API key - routes = client.directions(coords) - - print(routes) - -For convenience, all request performing module methods are wrapped inside the ``client`` class. This has the -disadvantage, that your IDE can't auto-show all positional and optional arguments for the -different methods. And there are a lot! - -The slightly more verbose alternative, preserving your IDE's smart functions, is - -.. code:: python - - import openrouteservice - from openrouteservice.directions import directions - - coords = ((8.34234,48.23424),(8.34423,48.26424)) - - client = openrouteservice.Client(key='') # Specify your personal API key - routes = directions(client, coords) # Now it shows you all arguments for .directions - -Optimize route -^^^^^^^^^^^^^^^^^^^^^^^^^^ -If you want to optimize the order of multiple waypoints in a simple `Traveling Salesman Problem `_, -you can pass a ``optimize_waypoints`` parameter: - -.. code:: python - - import openrouteservice - - coords = ((8.34234,48.23424),(8.34423,48.26424), (8.34523,48.24424), (8.41423,48.21424)) - - client = openrouteservice.Client(key='') # Specify your personal API key - routes = client.directions(coords, profile='cycling-regular', optimize_waypoints=True) - - print(routes) - -Decode Polyline -^^^^^^^^^^^^^^^^^^^^^^^^^^ -By default, the directions API returns `encoded polylines `_. -To decode to a ``dict``, which is a GeoJSON geometry object, simply do - -.. code:: python - - import openrouteservice - from openrouteservice import convert - - coords = ((8.34234,48.23424),(8.34423,48.26424)) - - client = openrouteservice.Client(key='') # Specify your personal API key - - # decode_polyline needs the geometry only - geometry = client.directions(coords)['routes'][0]['geometry'] - - decoded = convert.decode_polyline(geometry) - - print(decoded) - -Dry run -^^^^^^^^^^^^^^^^^^^^ -Although errors in query creation should be handled quite decently, you can do a dry run to print the request and its parameters: - -.. code:: python - - import openrouteservice - - coords = ((8.34234,48.23424),(8.34423,48.26424)) - - client = openrouteservice.Client() - client.directions(coords, dry_run='true') - -Local ORS instance -^^^^^^^^^^^^^^^^^^^^ -If you're hosting your own ORS instance, you can alter the ``base_url`` parameter to fit your own: - -.. code:: python - - import openrouteservice - - coords = ((8.34234,48.23424),(8.34423,48.26424)) - - # key can be omitted for local host - client = openrouteservice.Client(base_url='http://localhost/ors') - - # Only works if you didn't change the ORS endpoints manually - routes = client.directions(coords) - - # If you did change the ORS endpoints for some reason - # you'll have to pass url and required parameters explicitly: - routes = client.request( - url='/new_url', - post_json={ - 'coordinates': coords, - 'profile': 'driving-car', - 'format': 'geojson' - }) - -Support --------- - -For general support and questions, contact our forum_. - -For issues/bugs/enhancement suggestions, please use https://github.com/GIScience/openrouteservice-py/issues. - - -.. _forum: https://ask.openrouteservice.org/c/sdks - - -Acknowledgements ------------------ - -This library is based on the very elegant codebase from googlemaps_. - - -.. _googlemaps: https://github.com/googlemaps/google-maps-services-python diff --git a/cleanup.sh b/cleanup.sh new file mode 100755 index 00000000..5f4be820 --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,23 @@ + +mv "`pwd`/openrouteservice/utility.py" "`pwd`/utility.py" + +rm -r docs +rm -r .tox +rm -r openrouteservice +rm -r openrouteservice.egg-info +rm README.md +rm setup.py +rm requirements.txt +rm test-requirements.txt +rm tox.ini +rm .travis.yml +rm git_push.sh + +mkdir openrouteservice +mv "`pwd`/utility.py" "`pwd`/openrouteservice/utility.py" + +mkdir test/bup +mv test/test_*_api.py test/bup/ +rm test/test_*.py +mv test/bup/* test/ +rmdir test/bup/ diff --git a/docs/AlternativeRoutes.md b/docs/AlternativeRoutes.md new file mode 100644 index 00000000..5120bb4f --- /dev/null +++ b/docs/AlternativeRoutes.md @@ -0,0 +1,11 @@ +# AlternativeRoutes + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**share_factor** | **float** | Maximum fraction of the route that alternatives may share with the optimal route. The default value of 0.6 means alternatives can share up to 60% of path segments with the optimal route. | [optional] +**target_count** | **int** | Target number of alternative routes to compute. Service returns up to this number of routes that fulfill the share-factor and weight-factor constraints. | [optional] +**weight_factor** | **float** | Maximum factor by which route weight may diverge from the optimal route. The default value of 1.4 means alternatives can be up to 1.4 times longer (costly) than the optimal route. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/DirectionsServiceApi.md b/docs/DirectionsServiceApi.md new file mode 100644 index 00000000..909a36b5 --- /dev/null +++ b/docs/DirectionsServiceApi.md @@ -0,0 +1,112 @@ +# openrouteservice.DirectionsServiceApi + +> [!NOTE] +> This documentation is automatically generated. Code examples might not work out of the box as not all required parameters are passed. + +All URIs are relative to *https://api.openrouteservice.org* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_geo_json_route**](DirectionsServiceApi.md#get_geo_json_route) | **POST** /v2/directions/{profile}/geojson | Directions Service GeoJSON +[**get_json_route**](DirectionsServiceApi.md#get_json_route) | **POST** /v2/directions/{profile}/json | Directions Service JSON + +# **get_geo_json_route** +> JSONResponse get_geo_json_route(body, profile) + +Directions Service GeoJSON + +Returns a route between two or more locations for a selected profile and its settings as GeoJSON + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.DirectionsServiceApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.DirectionsServiceBody() # DirectionsServiceBody | +profile = 'profile_example' # str | Specifies the route profile. + +try: + # Directions Service GeoJSON + api_response = api_instance.get_geo_json_route(body, profile) + pprint(api_response) +except ApiException as e: + print("Exception when calling DirectionsServiceApi->get_geo_json_route: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**DirectionsServiceBody**](DirectionsServiceBody.md)| | + **profile** | **str**| Specifies the route profile. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/geo+json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + +# **get_json_route** +> JSONResponse get_json_route(body, profile) + +Directions Service JSON + +Returns a route between two or more locations for a selected profile and its settings as JSON + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.DirectionsServiceApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.DirectionsServiceBody() # DirectionsServiceBody | +profile = 'profile_example' # str | Specifies the route profile. + +try: + # Directions Service JSON + api_response = api_instance.get_json_route(body, profile) + pprint(api_response) +except ApiException as e: + print("Exception when calling DirectionsServiceApi->get_json_route: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**DirectionsServiceBody**](DirectionsServiceBody.md)| | + **profile** | **str**| Specifies the route profile. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + diff --git a/docs/DirectionsServiceBody.md b/docs/DirectionsServiceBody.md new file mode 100644 index 00000000..d8e2e61c --- /dev/null +++ b/docs/DirectionsServiceBody.md @@ -0,0 +1,35 @@ +# DirectionsServiceBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**alternative_routes** | [**AlternativeRoutes**](AlternativeRoutes.md) | | [optional] +**attributes** | **list[str]** | List of route attributes | [optional] +**bearings** | **list[list[float]]** | Specifies a list of pairs (bearings and deviations) to filter the segments of the road network a waypoint can snap to. \"For example `bearings=[[45,10],[120,20]]`. \"Each pair is a comma-separated list that can consist of one or two float values, where the first value is the bearing and the second one is the allowed deviation from the bearing. \"The bearing can take values between `0` and `360` clockwise from true north. If the deviation is not set, then the default value of `100` degrees is used. \"The number of pairs must correspond to the number of waypoints. \"The number of bearings corresponds to the length of waypoints-1 or waypoints. If the bearing information for the last waypoint is given, then this will control the sector from which the destination waypoint may be reached. \"You can skip a bearing for a certain waypoint by passing an empty value for an array, e.g. `[30,20],[],[40,20]`. | [optional] +**continue_straight** | **bool** | Forces the route to keep going straight at waypoints restricting uturns there even if it would be faster. | [optional] [default to False] +**coordinates** | **list[list[float]]** | The waypoints to use for the route as an array of `longitude/latitude` pairs in WGS 84 (EPSG:4326) | +**elevation** | **bool** | Specifies whether to return elevation values for points. Please note that elevation also gets encoded for json response encoded polyline. | [optional] +**extra_info** | **list[str]** | The extra info items to include in the response | [optional] +**geometry** | **bool** | Specifies whether to return geometry. | [optional] [default to True] +**geometry_simplify** | **bool** | Specifies whether to simplify the geometry. Simplify geometry cannot be applied to routes with more than **one segment** and when `extra_info` is required. | [optional] [default to False] +**id** | **str** | Arbitrary identification string of the request reflected in the meta information. | [optional] +**ignore_transfers** | **bool** | Specifies if transfers as criterion should be ignored. | [optional] [default to False] +**instructions** | **bool** | Specifies whether to return instructions. | [optional] [default to True] +**instructions_format** | **str** | Select html for more verbose instructions. | [optional] [default to 'text'] +**language** | **str** | Language for the route instructions. | [optional] [default to 'en'] +**maneuvers** | **bool** | Specifies whether the maneuver object is included into the step object or not. | [optional] [default to False] +**maximum_speed** | **float** | The maximum speed specified by user. | [optional] +**options** | [**RouteOptions**](RouteOptions.md) | | [optional] +**preference** | **str** | Specifies the route preference | [optional] [default to 'recommended'] +**radiuses** | **list[float]** | A list of maximum distances (measured in metres) that limit the search of nearby road segments to every given waypoint. The values must be greater than 0, the value of -1 specifies using the maximum possible search radius. The number of radiuses correspond to the number of waypoints. If only a single value is given, it will be applied to all waypoints. | [optional] +**roundabout_exits** | **bool** | Provides bearings of the entrance and all passed roundabout exits. Adds the `exit_bearings` array to the step object in the response. | [optional] [default to False] +**schedule** | **bool** | If true, return a public transport schedule starting at <departure> for the next <schedule_duration> minutes. | [optional] [default to False] +**schedule_duration** | **str** | The time window when requesting a public transport schedule. The format is passed as ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations | [optional] +**schedule_rows** | **int** | The maximum amount of entries that should be returned when requesting a schedule. | [optional] +**skip_segments** | **list[int]** | Specifies the segments that should be skipped in the route calculation. A segment is the connection between two given coordinates and the counting starts with 1 for the connection between the first and second coordinate. | [optional] +**suppress_warnings** | **bool** | Suppress warning messages in the response | [optional] +**units** | **str** | Specifies the distance unit. | [optional] [default to 'm'] +**walking_time** | **str** | Maximum duration for walking access and egress of public transport. The value is passed in ISO 8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations | [optional] [default to 'PT15M'] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/ElevationApi.md b/docs/ElevationApi.md new file mode 100644 index 00000000..cc2ac52a --- /dev/null +++ b/docs/ElevationApi.md @@ -0,0 +1,161 @@ +# openrouteservice.ElevationApi + +> [!NOTE] +> This documentation is automatically generated. Code examples might not work out of the box as not all required parameters are passed. + +All URIs are relative to *https://api.openrouteservice.org* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**elevation_line_post**](ElevationApi.md#elevation_line_post) | **POST** /elevation/line | Elevation Line Service +[**elevation_point_get**](ElevationApi.md#elevation_point_get) | **GET** /elevation/point | Elevation Point Service +[**elevation_point_post**](ElevationApi.md#elevation_point_post) | **POST** /elevation/point | Elevation Point Service + +# **elevation_line_post** +> JSONResponse elevation_line_post(body) + +Elevation Line Service + +This endpoint can take planar 2D line objects and enrich them with elevation from a variety of datasets. The input and output formats are: * GeoJSON * Polyline * Google's Encoded polyline with coordinate precision 5 or 6 Example: ``` # POST LineString as polyline curl -XPOST https://api.openrouteservice.org/elevation/line -H 'Content-Type: application/json' \\ -H 'Authorization: INSERT_YOUR_KEY -d '{ \"format_in\": \"polyline\", \"format_out\": \"encodedpolyline5\", \"geometry\": [[13.349762, 38.112952], [12.638397, 37.645772]] }' ``` + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.ElevationApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.ElevationLineBody() # ElevationLineBody | Query the elevation of a line in various formats. + +try: + # Elevation Line Service + api_response = api_instance.elevation_line_post(body) + pprint(api_response) +except ApiException as e: + print("Exception when calling ElevationApi->elevation_line_post: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ElevationLineBody**](ElevationLineBody.md)| Query the elevation of a line in various formats. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + +# **elevation_point_get** +> JSONResponse elevation_point_get(geometry, format_out=format_out, dataset=dataset) + +Elevation Point Service + +This endpoint can take a 2D point and enrich it with elevation from a variety of datasets. The output formats are: * GeoJSON * Point Example: ``` # GET point curl -XGET https://localhost:5000/elevation/point?geometry=13.349762,38.11295 ``` + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.ElevationApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +geometry = [3.4] # list[float] | The point to be queried, in comma-separated lon,lat values, e.g. [13.349762, 38.11295] +format_out = 'geojson' # str | The output format to be returned. (optional) (default to geojson) +dataset = 'srtm' # str | The elevation dataset to be used. (optional) (default to srtm) + +try: + # Elevation Point Service + api_response = api_instance.elevation_point_get(geometry, format_out=format_out, dataset=dataset) + pprint(api_response) +except ApiException as e: + print("Exception when calling ElevationApi->elevation_point_get: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **geometry** | [**list[float]**](float.md)| The point to be queried, in comma-separated lon,lat values, e.g. [13.349762, 38.11295] | + **format_out** | **str**| The output format to be returned. | [optional] [default to geojson] + **dataset** | **str**| The elevation dataset to be used. | [optional] [default to srtm] + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + +# **elevation_point_post** +> JSONResponse elevation_point_post(body) + +Elevation Point Service + +This endpoint can take a 2D point and enrich it with elevation from a variety of datasets. The input and output formats are: * GeoJSON * Point Example: ``` # POST point as GeoJSON # https://api.openrouteservice.org/elevation/point?api_key=YOUR-KEY { \"format_in\": \"geojson\", \"format_out\": \"geojson\", \"geometry\": { \"coordinates\": [13.349762, 38.11295], \"type\": \"Point\" } } ``` + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.ElevationApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.ElevationPointBody() # ElevationPointBody | Query the elevation of a point in various formats. + +try: + # Elevation Point Service + api_response = api_instance.elevation_point_post(body) + pprint(api_response) +except ApiException as e: + print("Exception when calling ElevationApi->elevation_point_post: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ElevationPointBody**](ElevationPointBody.md)| Query the elevation of a point in various formats. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + diff --git a/docs/ElevationLineBody.md b/docs/ElevationLineBody.md new file mode 100644 index 00000000..a39001cc --- /dev/null +++ b/docs/ElevationLineBody.md @@ -0,0 +1,12 @@ +# ElevationLineBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dataset** | **str** | The elevation dataset to be used. | [optional] [default to 'srtm'] +**format_in** | **str** | The input format the API has to expect. | +**format_out** | **str** | The output format to be returned. | [optional] [default to 'geojson'] +**geometry** | **object** | * geojson: A geometry object of a LineString GeoJSON, e.g. {\"type\": \"LineString\", \"coordinates\": [[13.331302, 38.108433],[13.331273, 38.10849]] } * polyline: A list of coordinate lists, e.g. [[13.331302, 38.108433], [13.331273, 38.10849]] * encodedpolyline5: A <a href=\"https://developers.google.com/maps/documentation/utilities/polylinealgorithm\">Google encoded polyline</a> with a coordinate precision of 5, e.g. u`rgFswjpAKD * encodedpolyline6: A <a href=\"https://developers.google.com/maps/documentation/utilities/polylinealgorithm\">Google encoded polyline</a> with a coordinate precision of 6, e.g. ap}tgAkutlXqBx@ | + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/ElevationPointBody.md b/docs/ElevationPointBody.md new file mode 100644 index 00000000..1f96f45b --- /dev/null +++ b/docs/ElevationPointBody.md @@ -0,0 +1,12 @@ +# ElevationPointBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dataset** | **str** | The elevation dataset to be used. | [optional] [default to 'srtm'] +**format_in** | **str** | The input format the API has to expect. | +**format_out** | **str** | The output format to be returned. | [optional] [default to 'geojson'] +**geometry** | **object** | * geojson: A geometry object of a Point GeoJSON, e.g. {\"type\": \"Point\", \"coordinates\": [13.331273, 38.10849] } * point: A coordinate list, e.g. [13.331273, 38.10849] | + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/GeocodeApi.md b/docs/GeocodeApi.md new file mode 100644 index 00000000..65fd1037 --- /dev/null +++ b/docs/GeocodeApi.md @@ -0,0 +1,304 @@ +# openrouteservice.GeocodeApi + +> [!NOTE] +> This documentation is automatically generated. Code examples might not work out of the box as not all required parameters are passed. + +All URIs are relative to *https://api.openrouteservice.org* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**geocode_autocomplete_get**](GeocodeApi.md#geocode_autocomplete_get) | **GET** /geocode/autocomplete | Geocode Autocomplete Service +[**geocode_reverse_get**](GeocodeApi.md#geocode_reverse_get) | **GET** /geocode/reverse | Reverse Geocode Service +[**geocode_search_get**](GeocodeApi.md#geocode_search_get) | **GET** /geocode/search | Forward Geocode Service +[**geocode_search_structured_get**](GeocodeApi.md#geocode_search_structured_get) | **GET** /geocode/search/structured | Structured Forward Geocode Service (beta) + +# **geocode_autocomplete_get** +> JSONResponse geocode_autocomplete_get(text, focus_point_lon=focus_point_lon, focus_point_lat=focus_point_lat, boundary_rect_min_lon=boundary_rect_min_lon, boundary_rect_min_lat=boundary_rect_min_lat, boundary_rect_max_lon=boundary_rect_max_lon, boundary_rect_max_lat=boundary_rect_max_lat, boundary_country=boundary_country, sources=sources, layers=layers) + +Geocode Autocomplete Service + +**Requests should be throttled when using this endpoint!** *Be aware that Responses are asynchronous.* Returns a JSON formatted list of objects corresponding to the search input. `boundary.*`-parameters can be combined if they are overlapping. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/autocomplete.md) + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.GeocodeApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +text = 'text_example' # str | Name of location, street address or postal code. +focus_point_lon = 3.4 # float | Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. (optional) +focus_point_lat = 3.4 # float | Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. (optional) +boundary_rect_min_lon = 3.4 # float | Left border of rectangular boundary to narrow results. (optional) +boundary_rect_min_lat = 3.4 # float | Bottom border of rectangular boundary to narrow results. (optional) +boundary_rect_max_lon = 3.4 # float | Right border of rectangular boundary to narrow results. (optional) +boundary_rect_max_lat = 3.4 # float | Top border of rectangular boundary to narrow results. (optional) +boundary_country = 'boundary_country_example' # str | Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. (optional) +sources = ['[\"osm\",\"oa\",\"gn\",\"wof\"]'] # list[str] | Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). (optional) (default to ["osm","oa","gn","wof"]) +layers = ['layers_example'] # list[str] | Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| (optional) + +try: + # Geocode Autocomplete Service + api_response = api_instance.geocode_autocomplete_get(text, focus_point_lon=focus_point_lon, focus_point_lat=focus_point_lat, boundary_rect_min_lon=boundary_rect_min_lon, boundary_rect_min_lat=boundary_rect_min_lat, boundary_rect_max_lon=boundary_rect_max_lon, boundary_rect_max_lat=boundary_rect_max_lat, boundary_country=boundary_country, sources=sources, layers=layers) + pprint(api_response) +except ApiException as e: + print("Exception when calling GeocodeApi->geocode_autocomplete_get: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **text** | **str**| Name of location, street address or postal code. | + **focus_point_lon** | **float**| Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. | [optional] + **focus_point_lat** | **float**| Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. | [optional] + **boundary_rect_min_lon** | **float**| Left border of rectangular boundary to narrow results. | [optional] + **boundary_rect_min_lat** | **float**| Bottom border of rectangular boundary to narrow results. | [optional] + **boundary_rect_max_lon** | **float**| Right border of rectangular boundary to narrow results. | [optional] + **boundary_rect_max_lat** | **float**| Top border of rectangular boundary to narrow results. | [optional] + **boundary_country** | **str**| Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. | [optional] + **sources** | [**list[str]**](str.md)| Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). | [optional] [default to ["osm","oa","gn","wof"]] + **layers** | [**list[str]**](str.md)| Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| | [optional] + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + +# **geocode_reverse_get** +> JSONResponse geocode_reverse_get(point_lon, point_lat, boundary_circle_radius=boundary_circle_radius, size=size, layers=layers, sources=sources, boundary_country=boundary_country) + +Reverse Geocode Service + +Returns the next enclosing object with an address tag which surrounds the given coordinate. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/reverse.md#reverse-geocoding) + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.GeocodeApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +point_lon = 3.4 # float | Longitude of the coordinate to query. +point_lat = 48.858268 # float | Latitude of the coordinate to query. (default to 48.858268) +boundary_circle_radius = 1 # float | Restrict search to circular region around `point.lat/point.lon`. Value in kilometers. (optional) (default to 1) +size = 10 # int | Set the number of returned results. (optional) (default to 10) +layers = ['layers_example'] # list[str] | Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `locality`|towns, hamlets, cities| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| (optional) +sources = ['[\"osm\",\"oa\",\"gn\",\"wof\"]'] # list[str] | Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). (optional) (default to ["osm","oa","gn","wof"]) +boundary_country = 'boundary_country_example' # str | Restrict search to country by [alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [alpha 3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) codes. (optional) + +try: + # Reverse Geocode Service + api_response = api_instance.geocode_reverse_get(point_lon, point_lat, boundary_circle_radius=boundary_circle_radius, size=size, layers=layers, sources=sources, boundary_country=boundary_country) + pprint(api_response) +except ApiException as e: + print("Exception when calling GeocodeApi->geocode_reverse_get: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **point_lon** | **float**| Longitude of the coordinate to query. | + **point_lat** | **float**| Latitude of the coordinate to query. | [default to 48.858268] + **boundary_circle_radius** | **float**| Restrict search to circular region around `point.lat/point.lon`. Value in kilometers. | [optional] [default to 1] + **size** | **int**| Set the number of returned results. | [optional] [default to 10] + **layers** | [**list[str]**](str.md)| Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `locality`|towns, hamlets, cities| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| | [optional] + **sources** | [**list[str]**](str.md)| Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). | [optional] [default to ["osm","oa","gn","wof"]] + **boundary_country** | **str**| Restrict search to country by [alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [alpha 3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) codes. | [optional] + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + +# **geocode_search_get** +> JSONResponse geocode_search_get(text, focus_point_lon=focus_point_lon, focus_point_lat=focus_point_lat, boundary_rect_min_lon=boundary_rect_min_lon, boundary_rect_min_lat=boundary_rect_min_lat, boundary_rect_max_lon=boundary_rect_max_lon, boundary_rect_max_lat=boundary_rect_max_lat, boundary_circle_lon=boundary_circle_lon, boundary_circle_lat=boundary_circle_lat, boundary_circle_radius=boundary_circle_radius, boundary_gid=boundary_gid, boundary_country=boundary_country, sources=sources, layers=layers, size=size) + +Forward Geocode Service + +Returns a JSON formatted list of objects corresponding to the search input. `boundary.*`-parameters can be combined if they are overlapping. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/search.md#search-the-world) + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.GeocodeApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +text = 'text_example' # str | Name of location, street address or postal code. +focus_point_lon = 3.4 # float | Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. (optional) +focus_point_lat = 3.4 # float | Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. (optional) +boundary_rect_min_lon = 3.4 # float | Left border of rectangular boundary to narrow results. (optional) +boundary_rect_min_lat = 3.4 # float | Bottom border of rectangular boundary to narrow results. (optional) +boundary_rect_max_lon = 3.4 # float | Right border of rectangular boundary to narrow results. (optional) +boundary_rect_max_lat = 3.4 # float | Top border of rectangular boundary to narrow results. (optional) +boundary_circle_lon = 3.4 # float | Center Longitude of circular boundary to narrow results. Use with `boundary.circle.lat` & `boundary.circle.radius`. (optional) +boundary_circle_lat = 3.4 # float | Center Latitude of circular boundary to narrow results. Use with `boundary.circle.lon` & `boundary.circle.radius`. (optional) +boundary_circle_radius = 50 # float | Radius of circular boundary around the center coordinate in kilometers. Use with `boundary.circle.lon` & `boundary.circle.lat`. (optional) (default to 50) +boundary_gid = 'boundary_gid_example' # str | Restrict results to administrative boundary using a Pelias global id [`gid`](https://github.com/pelias/documentation/blob/f1f475aa4f8c18426fb80baea636990502c08ed3/search.md#search-within-a-parent-administrative-area). `gid`s for records can be found using either the [Who's on First Spelunker](http://spelunker.whosonfirst.org/), a tool for searching Who's on First data, or from the responses of other Pelias queries. In this case a [search for Oklahoma](http://pelias.github.io/compare/#/v1/search%3Ftext=oklahoma) will return the proper `gid`. (optional) +boundary_country = 'boundary_country_example' # str | Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. (optional) +sources = ['[\"osm\",\"oa\",\"gn\",\"wof\"]'] # list[str] | Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). (optional) (default to ["osm","oa","gn","wof"]) +layers = ['layers_example'] # list[str] | Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| (optional) +size = 10 # int | Set the number of returned results. (optional) (default to 10) + +try: + # Forward Geocode Service + api_response = api_instance.geocode_search_get(text, focus_point_lon=focus_point_lon, focus_point_lat=focus_point_lat, boundary_rect_min_lon=boundary_rect_min_lon, boundary_rect_min_lat=boundary_rect_min_lat, boundary_rect_max_lon=boundary_rect_max_lon, boundary_rect_max_lat=boundary_rect_max_lat, boundary_circle_lon=boundary_circle_lon, boundary_circle_lat=boundary_circle_lat, boundary_circle_radius=boundary_circle_radius, boundary_gid=boundary_gid, boundary_country=boundary_country, sources=sources, layers=layers, size=size) + pprint(api_response) +except ApiException as e: + print("Exception when calling GeocodeApi->geocode_search_get: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **text** | **str**| Name of location, street address or postal code. | + **focus_point_lon** | **float**| Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. | [optional] + **focus_point_lat** | **float**| Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. | [optional] + **boundary_rect_min_lon** | **float**| Left border of rectangular boundary to narrow results. | [optional] + **boundary_rect_min_lat** | **float**| Bottom border of rectangular boundary to narrow results. | [optional] + **boundary_rect_max_lon** | **float**| Right border of rectangular boundary to narrow results. | [optional] + **boundary_rect_max_lat** | **float**| Top border of rectangular boundary to narrow results. | [optional] + **boundary_circle_lon** | **float**| Center Longitude of circular boundary to narrow results. Use with `boundary.circle.lat` & `boundary.circle.radius`. | [optional] + **boundary_circle_lat** | **float**| Center Latitude of circular boundary to narrow results. Use with `boundary.circle.lon` & `boundary.circle.radius`. | [optional] + **boundary_circle_radius** | **float**| Radius of circular boundary around the center coordinate in kilometers. Use with `boundary.circle.lon` & `boundary.circle.lat`. | [optional] [default to 50] + **boundary_gid** | **str**| Restrict results to administrative boundary using a Pelias global id [`gid`](https://github.com/pelias/documentation/blob/f1f475aa4f8c18426fb80baea636990502c08ed3/search.md#search-within-a-parent-administrative-area). `gid`s for records can be found using either the [Who's on First Spelunker](http://spelunker.whosonfirst.org/), a tool for searching Who's on First data, or from the responses of other Pelias queries. In this case a [search for Oklahoma](http://pelias.github.io/compare/#/v1/search%3Ftext=oklahoma) will return the proper `gid`. | [optional] + **boundary_country** | **str**| Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. | [optional] + **sources** | [**list[str]**](str.md)| Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). | [optional] [default to ["osm","oa","gn","wof"]] + **layers** | [**list[str]**](str.md)| Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| | [optional] + **size** | **int**| Set the number of returned results. | [optional] [default to 10] + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + +# **geocode_search_structured_get** +> JSONResponse geocode_search_structured_get(address=address, neighbourhood=neighbourhood, country=country, postalcode=postalcode, region=region, county=county, locality=locality, borough=borough, focus_point_lon=focus_point_lon, focus_point_lat=focus_point_lat, boundary_rect_min_lon=boundary_rect_min_lon, boundary_rect_min_lat=boundary_rect_min_lat, boundary_rect_max_lon=boundary_rect_max_lon, boundary_rect_max_lat=boundary_rect_max_lat, boundary_circle_lon=boundary_circle_lon, boundary_circle_lat=boundary_circle_lat, boundary_circle_radius=boundary_circle_radius, boundary_country=boundary_country, layers=layers, sources=sources, size=size) + +Structured Forward Geocode Service (beta) + +Returns a JSON formatted list of objects corresponding to the search input. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/structured-geocoding.md#structured-geocoding) + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.GeocodeApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +address = 'address_example' # str | Search for full address with house number or only a street name. (optional) +neighbourhood = 'neighbourhood_example' # str | Search for neighbourhoods. Neighbourhoods are vernacular geographic entities that may not necessarily be official administrative divisions but are important nonetheless. Example: `Notting Hill`. (optional) +country = 'country_example' # str | Search for full country name, [alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [alpha 3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) codes. (optional) +postalcode = 'postalcode_example' # str | Search for postal codes. Postal codes are unique within a country so they are useful in geocoding as a shorthand for a fairly granular geographical location. (optional) +region = 'region_example' # str | Search for regions. Regions are normally the first-level administrative divisions within countries. For US-regions [common abbreviations](https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations) can be used. (optional) +county = 'county_example' # str | Search for counties. Counties are administrative divisions between localities and regions. Can be useful when attempting to disambiguate between localities. (optional) +locality = 'Tokyo' # str | Search for localities. Localities are equivalent to what are commonly referred to as *cities*. (optional) (default to Tokyo) +borough = 'borough_example' # str | Search for boroughs. Boroughs are mostly known in the context of New York City, even though they may exist in other cities, such as Mexico City. Example: `Manhatten`. (optional) +focus_point_lon = 3.4 # float | Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. (optional) +focus_point_lat = 3.4 # float | Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. (optional) +boundary_rect_min_lon = 3.4 # float | Left border of rectangular boundary to narrow results. (optional) +boundary_rect_min_lat = 3.4 # float | Bottom border of rectangular boundary to narrow results. (optional) +boundary_rect_max_lon = 3.4 # float | Right border of rectangular boundary to narrow results. (optional) +boundary_rect_max_lat = 3.4 # float | Top border of rectangular boundary to narrow results. (optional) +boundary_circle_lon = 3.4 # float | Center Longitude of circular boundary to narrow results. Use with `boundary.circle.lat` & `boundary.circle.radius`. (optional) +boundary_circle_lat = 3.4 # float | Center Latitude of circular boundary to narrow results. Use with `boundary.circle.lon` & `boundary.circle.radius`. (optional) +boundary_circle_radius = 50 # float | Radius of circular boundary around the center coordinate in kilometers. Use with `boundary.circle.lon` & `boundary.circle.lat`. (optional) (default to 50) +boundary_country = 'boundary_country_example' # str | Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. (optional) +layers = ['layers_example'] # list[str] | Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| (optional) +sources = ['[\"osm\",\"oa\",\"gn\",\"wof\"]'] # list[str] | Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). (optional) (default to ["osm","oa","gn","wof"]) +size = 10 # int | Set the number of returned results. (optional) (default to 10) + +try: + # Structured Forward Geocode Service (beta) + api_response = api_instance.geocode_search_structured_get(address=address, neighbourhood=neighbourhood, country=country, postalcode=postalcode, region=region, county=county, locality=locality, borough=borough, focus_point_lon=focus_point_lon, focus_point_lat=focus_point_lat, boundary_rect_min_lon=boundary_rect_min_lon, boundary_rect_min_lat=boundary_rect_min_lat, boundary_rect_max_lon=boundary_rect_max_lon, boundary_rect_max_lat=boundary_rect_max_lat, boundary_circle_lon=boundary_circle_lon, boundary_circle_lat=boundary_circle_lat, boundary_circle_radius=boundary_circle_radius, boundary_country=boundary_country, layers=layers, sources=sources, size=size) + pprint(api_response) +except ApiException as e: + print("Exception when calling GeocodeApi->geocode_search_structured_get: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **address** | **str**| Search for full address with house number or only a street name. | [optional] + **neighbourhood** | **str**| Search for neighbourhoods. Neighbourhoods are vernacular geographic entities that may not necessarily be official administrative divisions but are important nonetheless. Example: `Notting Hill`. | [optional] + **country** | **str**| Search for full country name, [alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [alpha 3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) codes. | [optional] + **postalcode** | **str**| Search for postal codes. Postal codes are unique within a country so they are useful in geocoding as a shorthand for a fairly granular geographical location. | [optional] + **region** | **str**| Search for regions. Regions are normally the first-level administrative divisions within countries. For US-regions [common abbreviations](https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations) can be used. | [optional] + **county** | **str**| Search for counties. Counties are administrative divisions between localities and regions. Can be useful when attempting to disambiguate between localities. | [optional] + **locality** | **str**| Search for localities. Localities are equivalent to what are commonly referred to as *cities*. | [optional] [default to Tokyo] + **borough** | **str**| Search for boroughs. Boroughs are mostly known in the context of New York City, even though they may exist in other cities, such as Mexico City. Example: `Manhatten`. | [optional] + **focus_point_lon** | **float**| Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. | [optional] + **focus_point_lat** | **float**| Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. | [optional] + **boundary_rect_min_lon** | **float**| Left border of rectangular boundary to narrow results. | [optional] + **boundary_rect_min_lat** | **float**| Bottom border of rectangular boundary to narrow results. | [optional] + **boundary_rect_max_lon** | **float**| Right border of rectangular boundary to narrow results. | [optional] + **boundary_rect_max_lat** | **float**| Top border of rectangular boundary to narrow results. | [optional] + **boundary_circle_lon** | **float**| Center Longitude of circular boundary to narrow results. Use with `boundary.circle.lat` & `boundary.circle.radius`. | [optional] + **boundary_circle_lat** | **float**| Center Latitude of circular boundary to narrow results. Use with `boundary.circle.lon` & `boundary.circle.radius`. | [optional] + **boundary_circle_radius** | **float**| Radius of circular boundary around the center coordinate in kilometers. Use with `boundary.circle.lon` & `boundary.circle.lat`. | [optional] [default to 50] + **boundary_country** | **str**| Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. | [optional] + **layers** | [**list[str]**](str.md)| Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| | [optional] + **sources** | [**list[str]**](str.md)| Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). | [optional] [default to ["osm","oa","gn","wof"]] + **size** | **int**| Set the number of returned results. | [optional] [default to 10] + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + diff --git a/docs/IsochronesProfileBody.md b/docs/IsochronesProfileBody.md new file mode 100644 index 00000000..948979f9 --- /dev/null +++ b/docs/IsochronesProfileBody.md @@ -0,0 +1,20 @@ +# IsochronesProfileBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**area_units** | **str** | Specifies the area unit. Default: m. | [optional] [default to 'm'] +**attributes** | **list[str]** | List of isochrones attributes | [optional] +**id** | **str** | Arbitrary identification string of the request reflected in the meta information. | [optional] +**intersections** | **bool** | Specifies whether to return intersecting polygons. | [optional] [default to False] +**interval** | **float** | Interval of isochrones or equidistants. This is only used if a single range value is given. Value in **seconds** for time and **meters** for distance. | [optional] +**location_type** | **str** | `start` treats the location(s) as starting point, `destination` as goal. | [optional] [default to 'start'] +**locations** | **list[list[float]]** | The locations to use for the route as an array of `longitude/latitude` pairs in WGS 84 (EPSG:4326) | +**options** | [**RouteOptions**](RouteOptions.md) | | [optional] +**range** | **list[float]** | Maximum range value of the analysis in **seconds** for time and **metres** for distance.Alternatively a comma separated list of specific range values. Ranges will be the same for all locations. | +**range_type** | **str** | Specifies the isochrones reachability type. | [optional] [default to 'time'] +**smoothing** | **float** | Applies a level of generalisation to the isochrone polygons generated as a `smoothing_factor` between `0` and `100.0`. Generalisation is produced by determining a maximum length of a connecting line between two points found on the outside of a containing polygon. If the distance is larger than a threshold value, the line between the two points is removed and a smaller connecting line between other points is used. Note that the minimum length of this connecting line is ~1333m, and so when the `smoothing_factor` results in a distance smaller than this, the minimum value is used. The threshold value is determined as `(maximum_radius_of_isochrone / 100) * smoothing_factor`. Therefore, a value closer to 100 will result in a more generalised shape. The polygon generation algorithm is based on Duckham and al. (2008) `\"Efficient generation of simple polygons for characterizing the shape of a set of points in the plane.\"` | [optional] +**units** | **str** | Specifies the distance units only if `range_type` is set to distance. Default: m. | [optional] [default to 'm'] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/IsochronesServiceApi.md b/docs/IsochronesServiceApi.md new file mode 100644 index 00000000..145ad14e --- /dev/null +++ b/docs/IsochronesServiceApi.md @@ -0,0 +1,61 @@ +# openrouteservice.IsochronesServiceApi + +> [!NOTE] +> This documentation is automatically generated. Code examples might not work out of the box as not all required parameters are passed. + +All URIs are relative to *https://api.openrouteservice.org* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_default_isochrones**](IsochronesServiceApi.md#get_default_isochrones) | **POST** /v2/isochrones/{profile} | Isochrones Service + +# **get_default_isochrones** +> JSONResponse get_default_isochrones(body, profile) + +Isochrones Service + +The Isochrone Service supports time and distance analyses for one single or multiple locations. You may also specify the isochrone interval or provide multiple exact isochrone range values. This service allows the same range of profile options as the /directions endpoint, which help you to further customize your request to obtain a more detailed reachability area response. + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.IsochronesServiceApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.IsochronesProfileBody() # IsochronesProfileBody | +profile = 'profile_example' # str | Specifies the route profile. + +try: + # Isochrones Service + api_response = api_instance.get_default_isochrones(body, profile) + pprint(api_response) +except ApiException as e: + print("Exception when calling IsochronesServiceApi->get_default_isochrones: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**IsochronesProfileBody**](IsochronesProfileBody.md)| | + **profile** | **str**| Specifies the route profile. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/geo+json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + diff --git a/docs/JSONResponse.md b/docs/JSONResponse.md new file mode 100644 index 00000000..e32ee419 --- /dev/null +++ b/docs/JSONResponse.md @@ -0,0 +1,8 @@ +# JSONResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 447beb33..00000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = python -msphinx -SPHINXPROJ = openrouteservice-py -SOURCEDIR = source -BUILDDIR = build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/MatrixProfileBody.md b/docs/MatrixProfileBody.md new file mode 100644 index 00000000..b12ac602 --- /dev/null +++ b/docs/MatrixProfileBody.md @@ -0,0 +1,15 @@ +# MatrixProfileBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**destinations** | **list[str]** | A list of indices that refers to the list of locations (starting with `0`). `{index_1},{index_2}[,{index_N} ...]` or `all` (default). `[0,3]` for the first and fourth locations | [optional] +**id** | **str** | Arbitrary identification string of the request reflected in the meta information. | [optional] +**locations** | **list[list[float]]** | List of comma separated lists of `longitude,latitude` coordinates in WGS 84 (EPSG:4326) | +**metrics** | **list[str]** | Specifies a list of returned metrics. \"* `distance` - Returns distance matrix for specified points in defined `units`. * `duration` - Returns duration matrix for specified points in **seconds**. | [optional] +**resolve_locations** | **bool** | Specifies whether given locations are resolved or not. If the parameter value set to `true`, every element in `destinations` and `sources` will contain a `name` element that identifies the name of the closest street. Default is `false`. | [optional] [default to False] +**sources** | **list[str]** | A list of indices that refers to the list of locations (starting with `0`). `{index_1},{index_2}[,{index_N} ...]` or `all` (default). example `[0,3]` for the first and fourth locations | [optional] +**units** | **str** | Specifies the distance unit. Default: m. | [optional] [default to 'm'] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/MatrixServiceApi.md b/docs/MatrixServiceApi.md new file mode 100644 index 00000000..483d3637 --- /dev/null +++ b/docs/MatrixServiceApi.md @@ -0,0 +1,61 @@ +# openrouteservice.MatrixServiceApi + +> [!NOTE] +> This documentation is automatically generated. Code examples might not work out of the box as not all required parameters are passed. + +All URIs are relative to *https://api.openrouteservice.org* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_default1**](MatrixServiceApi.md#get_default1) | **POST** /v2/matrix/{profile} | Matrix Service + +# **get_default1** +> JSONResponse get_default1(body, profile) + +Matrix Service + +Returns duration or distance matrix for multiple source and destination points. By default a square duration matrix is returned where every point in locations is paired with each other. The result is null if a value can’t be determined. + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.MatrixServiceApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.MatrixProfileBody() # MatrixProfileBody | +profile = 'profile_example' # str | Specifies the matrix profile. + +try: + # Matrix Service + api_response = api_instance.get_default1(body, profile) + pprint(api_response) +except ApiException as e: + print("Exception when calling MatrixServiceApi->get_default1: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**MatrixProfileBody**](MatrixProfileBody.md)| | + **profile** | **str**| Specifies the matrix profile. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json;charset=UTF-8, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + diff --git a/docs/OpenpoiservicePoiRequest.md b/docs/OpenpoiservicePoiRequest.md new file mode 100644 index 00000000..4782b7ff --- /dev/null +++ b/docs/OpenpoiservicePoiRequest.md @@ -0,0 +1,13 @@ +# OpenpoiservicePoiRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**filters** | [**PoisFilters**](PoisFilters.md) | | [optional] +**geometry** | [**PoisGeometry**](PoisGeometry.md) | | +**limit** | **int** | The limit of objects to be returned in the response. | [optional] +**request** | **str** | Examples: ``` #### JSON bodies for POST requests ##### Pois around a buffered point { \"request\": \"pois\", \"geometry\": { \"bbox\": [ [8.8034, 53.0756], [8.7834, 53.0456] ], \"geojson\": { \"type\": \"Point\", \"coordinates\": [8.8034, 53.0756] }, \"buffer\": 250 } } ##### Pois given categories { \"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 given category groups { \"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] } } ##### Pois statistics { \"request\": \"stats\", \"geometry\": { \"bbox\": [ [8.8034, 53.0756], [8.7834, 53.0456] ], \"geojson\": { \"type\": \"Point\", \"coordinates\": [8.8034, 53.0756] }, \"buffer\": 100 } } ##### Pois categories as a list { \"request\": \"list\" } ``` | +**sortby** | **str** | Either you can sort by category or the distance to the geometry object provided in the request. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationApi.md b/docs/OptimizationApi.md new file mode 100644 index 00000000..38413d8b --- /dev/null +++ b/docs/OptimizationApi.md @@ -0,0 +1,59 @@ +# openrouteservice.OptimizationApi + +> [!NOTE] +> This documentation is automatically generated. Code examples might not work out of the box as not all required parameters are passed. + +All URIs are relative to *https://api.openrouteservice.org* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**optimization_post**](OptimizationApi.md#optimization_post) | **POST** /optimization | Optimization Service + +# **optimization_post** +> JSONResponse optimization_post(body) + +Optimization Service + +The optimization endpoint solves [Vehicle Routing Problems](https://en.wikipedia.org/wiki/Vehicle_routing_problem) and can be used to schedule multiple vehicles and jobs, respecting time windows, capacities and required skills. This service is based on the excellent [Vroom project](https://github.com/VROOM-Project/vroom). Please also consult its [API documentation](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md). General Info: - The expected order for all coordinates arrays is `[lon, lat]` - All timings are in seconds - All distances are in meters - A `time_window` object is a pair of timestamps in the form `[start, end]` + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.OptimizationApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.OptimizationBody() # OptimizationBody | The request body of the optimization request. + +try: + # Optimization Service + api_response = api_instance.optimization_post(body) + pprint(api_response) +except ApiException as e: + print("Exception when calling OptimizationApi->optimization_post: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OptimizationBody**](OptimizationBody.md)| The request body of the optimization request. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + diff --git a/docs/OptimizationBody.md b/docs/OptimizationBody.md new file mode 100644 index 00000000..0ae161e5 --- /dev/null +++ b/docs/OptimizationBody.md @@ -0,0 +1,12 @@ +# OptimizationBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**jobs** | [**list[OptimizationJobs]**](OptimizationJobs.md) | Array of `job` objects describing the places to visit. For a detailed object description visit the [VROOM api description](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md#jobs) | +**matrices** | [**OptimizationMatrices**](OptimizationMatrices.md) | | [optional] +**options** | [**OptimizationOptions**](OptimizationOptions.md) | | [optional] +**vehicles** | [**list[OptimizationVehicles]**](OptimizationVehicles.md) | Array of `vehicle` objects describing the available vehicles. For a detailed object description visit the [VROOM API description](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md#vehicles) | + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationBreaks.md b/docs/OptimizationBreaks.md new file mode 100644 index 00000000..a0c28f57 --- /dev/null +++ b/docs/OptimizationBreaks.md @@ -0,0 +1,13 @@ +# OptimizationBreaks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **str** | a string describing this break | [optional] +**id** | **int** | Integer used as unique identifier | [optional] +**max_load** | **list[float]** | Array of integers describing the maximum vehicle load for which this break can happen. An error is reported if two break objects have the same id for the same vehicle. | [optional] +**service** | **float** | break duration in seconds (defaults to 0) | [optional] [default to 0] +**time_windows** | **list[list[int]]** | Array of time_window objects describing valid slots for break start and end, in week seconds, i.e. 28800 = Mon, 8 AM. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationCosts.md b/docs/OptimizationCosts.md new file mode 100644 index 00000000..0e68055b --- /dev/null +++ b/docs/OptimizationCosts.md @@ -0,0 +1,11 @@ +# OptimizationCosts + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fixed** | **float** | integer defining the cost of using this vehicle in the solution (defaults to 0) | [optional] [default to 0] +**per_hour** | **float** | integer defining the cost for one hour of travel time with this vehicle (defaults to 3600) | [optional] [default to 3600] +**per_km** | **float** | integer defining the cost for one km of travel time with this vehicle (defaults to 0) | [optional] [default to 0] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationJobs.md b/docs/OptimizationJobs.md new file mode 100644 index 00000000..8b7b8bb0 --- /dev/null +++ b/docs/OptimizationJobs.md @@ -0,0 +1,19 @@ +# OptimizationJobs + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**delivery** | **list[float]** | an array of integers describing multidimensional quantities for delivery | [optional] +**description** | **str** | a string describing this job | [optional] +**id** | **int** | an integer used as unique identifier | [optional] +**location** | **list[list[float]]** | coordinates array in `[lon, lat]` | [optional] +**location_index** | **object** | index of relevant row and column in custom matrix | [optional] +**pickup** | **list[float]** | an array of integers describing multidimensional quantities for pickup | [optional] +**priority** | **float** | an integer in the range [0, 100] describing priority level (defaults to 0) | [optional] [default to 0] +**service** | **object** | job service duration (defaults to 0), in seconds | [optional] +**setup** | **float** | job setup duration (defaults to 0), in seconds | [optional] +**skills** | **list[int]** | Array of integers defining mandatory skills for this job | [optional] +**time_windows** | **list[list[int]]** | Array of `time_window` arrays describing valid slots for job service start and end, in week seconds, i.e. 28800 = Mon, 8 AM. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationMatrices.md b/docs/OptimizationMatrices.md new file mode 100644 index 00000000..ccdb6241 --- /dev/null +++ b/docs/OptimizationMatrices.md @@ -0,0 +1,17 @@ +# OptimizationMatrices + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cycling_electric** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] +**cycling_mountain** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] +**cycling_regular** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] +**cycling_road** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] +**driving_car** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] +**driving_hgv** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] +**foot_hiking** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] +**foot_walking** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] +**wheelchair** | [**OptimizationMatricesCyclingelectric**](OptimizationMatricesCyclingelectric.md) | | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationMatricesCyclingelectric.md b/docs/OptimizationMatricesCyclingelectric.md new file mode 100644 index 00000000..dd9101a4 --- /dev/null +++ b/docs/OptimizationMatricesCyclingelectric.md @@ -0,0 +1,11 @@ +# OptimizationMatricesCyclingelectric + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**costs** | **list[list[int]]** | costs for a custom cost matrix that will be used within all route cost evaluations | [optional] +**distances** | **list[list[int]]** | distances for a custom distance matrix | [optional] +**durations** | **list[list[int]]** | Durations for a custom travel-time matrix that will be used for all checks against timing constraints | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationOptions.md b/docs/OptimizationOptions.md new file mode 100644 index 00000000..36f593e0 --- /dev/null +++ b/docs/OptimizationOptions.md @@ -0,0 +1,9 @@ +# OptimizationOptions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**g** | **bool** | Calculate geometries for the optimized routes. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationSteps.md b/docs/OptimizationSteps.md new file mode 100644 index 00000000..9726f8b3 --- /dev/null +++ b/docs/OptimizationSteps.md @@ -0,0 +1,13 @@ +# OptimizationSteps + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **float** | id of the task to be performed at this step if `type` value is not `start` or `end` | [optional] +**service_after** | **float** | hard constraint on service time lower bound (as absolute or relative timestamp) | [optional] +**service_at** | **float** | hard constraint on service time (as absolute or relative timestamp) | [optional] +**service_before** | **float** | hard constraint on service time upper bound (as absolute or relative timestamp) | [optional] +**type** | **str** | step type (either start, job, pickup, delivery, break or end)] | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/OptimizationVehicles.md b/docs/OptimizationVehicles.md new file mode 100644 index 00000000..e2fcd2bb --- /dev/null +++ b/docs/OptimizationVehicles.md @@ -0,0 +1,25 @@ +# OptimizationVehicles + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breaks** | [**list[OptimizationBreaks]**](OptimizationBreaks.md) | An array of `break` objects | [optional] +**capacity** | **list[int]** | Array of integers describing multidimensional quantities. | [optional] +**costs** | [**OptimizationCosts**](OptimizationCosts.md) | | [optional] +**description** | **str** | a string describing this vehicle | [optional] +**end** | **list[float]** | End coordinates array in `[lon, lat]` format. If left blank, the optimization engine will identify the optimal end point. | [optional] +**end_index** | **object** | Index of relevant row and column in custom matrix. | [optional] +**id** | **int** | Integer used as unique identifier | [optional] +**max_distance** | **float** | an integer defining the maximum distance for this vehicle | [optional] +**max_tasks** | **float** | an integer defining the maximum number of tasks in a route for this vehicle | [optional] +**max_travel_time** | **float** | an integer defining the maximum travel time for this vehicle | [optional] +**profile** | **str** | The ORS routing profile for the vehicle. | [optional] +**skills** | **list[int]** | Array of integers defining skills for this vehicle | [optional] +**speed_factor** | **float** | A double value in the range (0, 5] used to scale all vehicle travel times (defaults to 1.). The respected precision is limited to two digits after the decimal point. | [optional] +**start** | **list[float]** | Start coordinates array in `[lon, lat]` format. If left blank, the optimization engine will identify the optimal start point. | [optional] +**start_index** | **object** | Index of relevant row and column in custom matrix. | [optional] +**steps** | [**list[OptimizationSteps]**](OptimizationSteps.md) | | [optional] +**time_window** | **list[int]** | A `time_window` array describing working hours for this vehicle, in week seconds, i.e. 28800 = Mon, 8 AM. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/PoisApi.md b/docs/PoisApi.md new file mode 100644 index 00000000..3119299d --- /dev/null +++ b/docs/PoisApi.md @@ -0,0 +1,59 @@ +# openrouteservice.PoisApi + +> [!NOTE] +> This documentation is automatically generated. Code examples might not work out of the box as not all required parameters are passed. + +All URIs are relative to *https://api.openrouteservice.org* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**pois_post**](PoisApi.md#pois_post) | **POST** /pois | Pois Service + +# **pois_post** +> JSONResponse pois_post(body) + +Pois Service + +Returns points of interest in the area surrounding a geometry which can either be a bounding box, polygon or buffered linestring or point. Find more examples on [github](https://github.com/GIScience/openpoiservice). + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.PoisApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.OpenpoiservicePoiRequest() # OpenpoiservicePoiRequest | body for a post request + +try: + # Pois Service + api_response = api_instance.pois_post(body) + pprint(api_response) +except ApiException as e: + print("Exception when calling PoisApi->pois_post: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OpenpoiservicePoiRequest**](OpenpoiservicePoiRequest.md)| body for a post request | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + diff --git a/docs/PoisFilters.md b/docs/PoisFilters.md new file mode 100644 index 00000000..d7249d9f --- /dev/null +++ b/docs/PoisFilters.md @@ -0,0 +1,14 @@ +# PoisFilters + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category_group_ids** | **list[int]** | | [optional] +**category_ids** | **list[int]** | | [optional] +**fee** | **list[str]** | Filter example. | [optional] +**name** | **list[str]** | Filter by name of the poi object. | [optional] +**smoking** | **list[str]** | Filter example. | [optional] +**wheelchair** | **list[str]** | Filter example. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/PoisGeometry.md b/docs/PoisGeometry.md new file mode 100644 index 00000000..0cbc421a --- /dev/null +++ b/docs/PoisGeometry.md @@ -0,0 +1,11 @@ +# PoisGeometry + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bbox** | **list[float]** | The pattern for this bbox string is minlon,minlat,maxlon,maxlat | [optional] +**buffer** | **int** | | [optional] +**geojson** | **object** | This is a GeoJSON object. Is either Point, Polygon or LineString. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProfileGeojsonBody.md b/docs/ProfileGeojsonBody.md new file mode 100644 index 00000000..35cceb03 --- /dev/null +++ b/docs/ProfileGeojsonBody.md @@ -0,0 +1,11 @@ +# ProfileGeojsonBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Arbitrary identification string of the request reflected in the meta information. | [optional] +**locations** | **list[list[float]]** | The locations to be snapped as array of `longitude/latitude` pairs. | +**radius** | **float** | Maximum radius in meters around given coordinates to search for graph edges. | + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProfileJsonBody.md b/docs/ProfileJsonBody.md new file mode 100644 index 00000000..bd40758b --- /dev/null +++ b/docs/ProfileJsonBody.md @@ -0,0 +1,11 @@ +# ProfileJsonBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Arbitrary identification string of the request reflected in the meta information. | [optional] +**locations** | **list[list[float]]** | The locations to be snapped as array of `longitude/latitude` pairs. | +**radius** | **float** | Maximum radius in meters around given coordinates to search for graph edges. | + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProfileParameters.md b/docs/ProfileParameters.md new file mode 100644 index 00000000..8cc9b42c --- /dev/null +++ b/docs/ProfileParameters.md @@ -0,0 +1,12 @@ +# ProfileParameters + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**allow_unsuitable** | **bool** | Specifies if ways that might not be suitable (e.g. unknown pedestrian usage) should be included in finding routes - default false | [optional] +**restrictions** | [**ProfileParametersRestrictions**](ProfileParametersRestrictions.md) | | [optional] +**surface_quality_known** | **bool** | Specifies whether to enforce that only ways with known information on surface quality be taken into account - default false | [optional] +**weightings** | [**ProfileWeightings**](ProfileWeightings.md) | | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProfileParametersRestrictions.md b/docs/ProfileParametersRestrictions.md new file mode 100644 index 00000000..02ff8f7b --- /dev/null +++ b/docs/ProfileParametersRestrictions.md @@ -0,0 +1,20 @@ +# ProfileParametersRestrictions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**axleload** | **float** | Axleload restriction in tons. | [optional] +**hazmat** | **bool** | Specifies whether to use appropriate routing for delivering hazardous goods and avoiding water protected areas. Default is `false`. | [optional] [default to False] +**height** | **float** | Height restriction in metres. | [optional] +**length** | **float** | Length restriction in metres. | [optional] +**maximum_incline** | **int** | Specifies the maximum incline as a percentage. `3`, `6` (default), `10`, `15. | [optional] [default to 6] +**maximum_sloped_kerb** | **float** | Specifies the maximum height of the sloped curb in metres. Values are `0.03`, `0.06` (default), `0.1`. | [optional] [default to 0.6] +**minimum_width** | **float** | Specifies the minimum width of the footway in metres. | [optional] +**smoothness_type** | **str** | Specifies the minimum smoothness of the route. Default is `good`. | [optional] [default to 'good'] +**surface_type** | **str** | Specifies the minimum surface type. Default is `sett`. | [optional] [default to 'sett'] +**track_type** | **str** | Specifies the minimum grade of the route. Default is `grade1`. | [optional] [default to 'grade1'] +**weight** | **float** | Weight restriction in tons. | [optional] +**width** | **float** | Width restriction in metres. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProfileWeightings.md b/docs/ProfileWeightings.md new file mode 100644 index 00000000..1272d507 --- /dev/null +++ b/docs/ProfileWeightings.md @@ -0,0 +1,12 @@ +# ProfileWeightings + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**green** | **float** | Specifies the Green factor for `foot-*` profiles. factor: Multiplication factor range from 0 to 1. 0 is the green routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer ways through green areas over a shorter route. | [optional] +**quiet** | **float** | Specifies the Quiet factor for foot-* profiles. factor: Multiplication factor range from 0 to 1. 0 is the quiet routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer quiet ways over a shorter route. | [optional] +**shadow** | **float** | Specifies the shadow factor for `foot-*` profiles. factor: Multiplication factor range from 0 to 1. 0 is the shadow routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer ways through shadow areas over a shorter route. | [optional] +**steepness_difficulty** | **int** | Specifies the fitness level for `cycling-*` profiles. level: 0 = Novice, 1 = Moderate, 2 = Amateur, 3 = Pro. The prefered gradient increases with level. | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/RoundTripRouteOptions.md b/docs/RoundTripRouteOptions.md new file mode 100644 index 00000000..66f8852d --- /dev/null +++ b/docs/RoundTripRouteOptions.md @@ -0,0 +1,11 @@ +# RoundTripRouteOptions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **float** | The target length of the route in `m` (note that this is a preferred value, but results may be different). | [optional] +**points** | **int** | The number of points to use on the route. Larger values create more circular routes. | [optional] +**seed** | **int** | A seed to use for adding randomisation to the overall direction of the generated route | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/RouteOptions.md b/docs/RouteOptions.md new file mode 100644 index 00000000..aa0dff38 --- /dev/null +++ b/docs/RouteOptions.md @@ -0,0 +1,15 @@ +# RouteOptions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**avoid_borders** | **str** | Specify which type of border crossing to avoid | [optional] +**avoid_countries** | **list[str]** | List of countries to exclude from matrix with `driving-*` profiles. Can be used together with `'avoid_borders': 'controlled'`. `[ 11, 193 ]` would exclude Austria and Switzerland. List of countries and application examples can be found [here](https://giscience.github.io/openrouteservice/technical-details/country-list). Also, ISO standard country codes cna be used in place of the numerical ids, for example, DE or DEU for Germany. | [optional] +**avoid_features** | **list[str]** | List of features to avoid. | [optional] +**avoid_polygons** | [**RouteOptionsAvoidPolygons**](RouteOptionsAvoidPolygons.md) | | [optional] +**profile_params** | [**ProfileParameters**](ProfileParameters.md) | | [optional] +**round_trip** | [**RoundTripRouteOptions**](RoundTripRouteOptions.md) | | [optional] +**vehicle_type** | **str** | Definition of the vehicle type. | [optional] [default to 'hgv'] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/RouteOptionsAvoidPolygons.md b/docs/RouteOptionsAvoidPolygons.md new file mode 100644 index 00000000..b9b5fb99 --- /dev/null +++ b/docs/RouteOptionsAvoidPolygons.md @@ -0,0 +1,9 @@ +# RouteOptionsAvoidPolygons + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**empty** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/SnapProfileBody.md b/docs/SnapProfileBody.md new file mode 100644 index 00000000..8b6a8120 --- /dev/null +++ b/docs/SnapProfileBody.md @@ -0,0 +1,11 @@ +# SnapProfileBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Arbitrary identification string of the request reflected in the meta information. | [optional] +**locations** | **list[list[float]]** | The locations to be snapped as array of `longitude/latitude` pairs. | +**radius** | **float** | Maximum radius in meters around given coordinates to search for graph edges. | + +[[Back to Model list]](../README.md#documentation_for_models) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to README]](../README.md) + diff --git a/docs/SnappingServiceApi.md b/docs/SnappingServiceApi.md new file mode 100644 index 00000000..06529aa9 --- /dev/null +++ b/docs/SnappingServiceApi.md @@ -0,0 +1,163 @@ +# openrouteservice.SnappingServiceApi + +> [!NOTE] +> This documentation is automatically generated. Code examples might not work out of the box as not all required parameters are passed. + +All URIs are relative to *https://api.openrouteservice.org* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_default**](SnappingServiceApi.md#get_default) | **POST** /v2/snap/{profile} | Snapping Service +[**get_geo_json_snapping**](SnappingServiceApi.md#get_geo_json_snapping) | **POST** /v2/snap/{profile}/geojson | Snapping Service GeoJSON +[**get_json_snapping**](SnappingServiceApi.md#get_json_snapping) | **POST** /v2/snap/{profile}/json | Snapping Service JSON + +# **get_default** +> JSONResponse get_default(body, profile) + +Snapping Service + +Returns a list of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, \"null\" is returned. + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.SnappingServiceApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.SnapProfileBody() # SnapProfileBody | +profile = 'profile_example' # str | Specifies the route profile. + +try: + # Snapping Service + api_response = api_instance.get_default(body, profile) + pprint(api_response) +except ApiException as e: + print("Exception when calling SnappingServiceApi->get_default: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**SnapProfileBody**](SnapProfileBody.md)| | + **profile** | **str**| Specifies the route profile. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + +# **get_geo_json_snapping** +> JSONResponse get_geo_json_snapping(body, profile) + +Snapping Service GeoJSON + +Returns a GeoJSON FeatureCollection of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, it is omitted from the features array. The features provide the 'source_id' property, to match the results with the input location array (IDs start at 0). + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.SnappingServiceApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.ProfileGeojsonBody() # ProfileGeojsonBody | +profile = 'profile_example' # str | Specifies the profile. + +try: + # Snapping Service GeoJSON + api_response = api_instance.get_geo_json_snapping(body, profile) + pprint(api_response) +except ApiException as e: + print("Exception when calling SnappingServiceApi->get_geo_json_snapping: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ProfileGeojsonBody**](ProfileGeojsonBody.md)| | + **profile** | **str**| Specifies the profile. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + +# **get_json_snapping** +> JSONResponse get_json_snapping(body, profile) + +Snapping Service JSON + +Returns a list of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, \"null\" is returned. + +### Example +```python +from __future__ import print_function +import time +import openrouteservice +from openrouteservice.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = openrouteservice.SnappingServiceApi(openrouteservice.apiClient(apiKey='YOUR_API_KEY')) +body = openrouteservice.ProfileJsonBody() # ProfileJsonBody | +profile = 'profile_example' # str | Specifies the profile. + +try: + # Snapping Service JSON + api_response = api_instance.get_json_snapping(body, profile) + pprint(api_response) +except ApiException as e: + print("Exception when calling SnappingServiceApi->get_json_snapping: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ProfileJsonBody**](ProfileJsonBody.md)| | + **profile** | **str**| Specifies the profile. | + +### Return type + +[**JSONResponse**](JSONResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation_for_api_endpoints) [[Back to Model list]](../README.md#documentation_for_models) [[Back to README]](../README.md) + diff --git a/docs/examples/Avoid_ConstructionSites.md b/docs/examples/Avoid_ConstructionSites.md new file mode 100644 index 00000000..5d466fe0 --- /dev/null +++ b/docs/examples/Avoid_ConstructionSites.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/examples/Dieselgate_Routing.md b/docs/examples/Dieselgate_Routing.md new file mode 100644 index 00000000..fad9d1af --- /dev/null +++ b/docs/examples/Dieselgate_Routing.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/examples/Routing_Optimization_Idai.md b/docs/examples/Routing_Optimization_Idai.md new file mode 100644 index 00000000..40ebca82 --- /dev/null +++ b/docs/examples/Routing_Optimization_Idai.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/examples/ortools_pubcrawl.md b/docs/examples/ortools_pubcrawl.md new file mode 100644 index 00000000..c00d974a --- /dev/null +++ b/docs/examples/ortools_pubcrawl.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index ee1886d0..00000000 --- a/docs/make.bat +++ /dev/null @@ -1,36 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=python -msphinx -) -set SOURCEDIR=source -set BUILDDIR=build -set SPHINXPROJ=openrouteservice-py - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The Sphinx module was not found. Make sure you have Sphinx installed, - echo.then set the SPHINXBUILD environment variable to point to the full - echo.path of the 'sphinx-build' executable. Alternatively you may add the - echo.Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index 2a0c4940..00000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,176 +0,0 @@ -# -*- coding: utf-8 -*- -# openrouteservice-py documentation build configuration file, created by -# sphinx-quickstart on Wed Jan 31 20:43:55 2018. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -import os -import sys - -# sys.path.insert(0, 'C:\\Users\\gisadmin\\Documents\\Dev\\Git\\Uni\\ORS\\infrastructure\\SDK\\openrouteservice-python-api\\openrouteservice') -sys.path.insert(0, os.path.abspath("../..")) - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ["sphinx.ext.autodoc", "sphinx.ext.todo", "sphinx.ext.coverage"] - -# Add any paths that contain templates here, relative to this directory. -templates_path = [".templates"] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = ".rst" - -# The master toctree document. -master_doc = "index" - -# General information about the project. -project = "openrouteservice-py" -copyright = "2023, HeiGIT gGmbH" -author = "HeiGIT gGmbH" - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = "0.4" -# The full version, including alpha/beta/rc tags. -release = "0.4" - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = [".static"] - -# Custom sidebar templates, must be a dictionary that maps document names -# to template names. -# -# This is required for the alabaster theme -# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars -html_sidebars = { - "**": [ - "about.html", - "navigation.html", - "relations.html", # needs 'show_related': True theme option to display - "searchbox.html", - "donate.html", - ] -} - -# -- Options for HTMLHelp output ------------------------------------------ - -# Output file base name for HTML help builder. -htmlhelp_basename = "openrouteservice-pydoc" - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - master_doc, - "openrouteservice-py.tex", - "openrouteservice-py Documentation", - "HeiGIT gGmbH", - "manual", - ), -] - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - master_doc, - "openrouteservice-py", - "openrouteservice-py Documentation", - [author], - 1, - ) -] - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - master_doc, - "openrouteservice-py", - "openrouteservice-py Documentation", - author, - "openrouteservice-py", - "One line description of project.", - "Miscellaneous", - ), -] diff --git a/docs/source/index.rst b/docs/source/index.rst deleted file mode 100644 index 34578f23..00000000 --- a/docs/source/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. openrouteservice-py documentation master file, created by - sphinx-quickstart on Wed Jan 31 20:43:55 2018. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - - -.. include:: ../../README.rst -.. include:: openrouteservice.rst - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - - -Indices and tables -================== - -.. toctree:: - :maxdepth: 4 - - readme_link - openrouteservice diff --git a/docs/source/modules.rst b/docs/source/modules.rst deleted file mode 100644 index b45c4804..00000000 --- a/docs/source/modules.rst +++ /dev/null @@ -1,5 +0,0 @@ -docs -==== - -.. toctree:: - :maxdepth: 4 diff --git a/docs/source/openrouteservice.rst b/docs/source/openrouteservice.rst deleted file mode 100644 index fff88920..00000000 --- a/docs/source/openrouteservice.rst +++ /dev/null @@ -1,94 +0,0 @@ -Library reference -======================== - -Submodules ----------- - -openrouteservice\.client module -------------------------------- - -.. automodule:: openrouteservice.client - :members: - :exclude-members: directions, isochrones, distance_matrix, places, pelias_reverse, pelias_search, pelias_structured, pelias_autocomplete, elevation_line, elevation_point, optimization - :show-inheritance: - -openrouteservice\.convert module --------------------------------- - -.. automodule:: openrouteservice.convert - :members: - :undoc-members: - :show-inheritance: - -openrouteservice\.directions module ------------------------------------ - -.. automodule:: openrouteservice.directions - :members: - :undoc-members: - :show-inheritance: - -openrouteservice\.isochrones module ------------------------------------ - -.. automodule:: openrouteservice.isochrones - :members: - :undoc-members: - :show-inheritance: - -openrouteservice\.distance\_matrix module ------------------------------------------ - -.. automodule:: openrouteservice.distance_matrix - :members: - :undoc-members: - :show-inheritance: - -openrouteservice\.geocode module ----------------------------------- - -.. automodule:: openrouteservice.geocode - :members: - :undoc-members: - :show-inheritance: - -openrouteservice\.elevation module ----------------------------------- - -.. automodule:: openrouteservice.elevation - :members: - :undoc-members: - :show-inheritance: - -openrouteservice\.places module --------------------------------- - -.. automodule:: openrouteservice.places - :members: - :undoc-members: - :show-inheritance: - -openrouteservice\.optimization module ------------------------------------- - -.. automodule:: openrouteservice.optimization - :members: - :undoc-members: - :show-inheritance: - -openrouteservice\.exceptions module ------------------------------------ - -.. automodule:: openrouteservice.exceptions - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: openrouteservice - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/readme_link.rst b/docs/source/readme_link.rst deleted file mode 100644 index a6210d3d..00000000 --- a/docs/source/readme_link.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../README.rst diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 0d21131d..00000000 --- a/environment.yml +++ /dev/null @@ -1,10 +0,0 @@ -# for https://mybinder.org -# from https://github.com/binder-examples/python-conda_pip/blob/master/environment.yml -name: orspy-examples -channels: - - conda-forge -dependencies: - - python - - folium - - pip: - - openrouteservice diff --git a/examples/Avoid_ConstructionSites.ipynb b/examples/Avoid_ConstructionSites.ipynb new file mode 100644 index 00000000..77e64aa4 --- /dev/null +++ b/examples/Avoid_ConstructionSites.ipynb @@ -0,0 +1,6213 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Avoiding construction sites dynamically\n", + "> Note: All notebooks need the [environment dependencies](https://github.com/GIScience/openrouteservice-examples#local-installation)\n", + "> as well as an [openrouteservice API key](https://ors.org/dev/#/signup) to run" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this example, we'd like to showcase how to use the [directions API][directions] and to avoid a number of\n", + "construction sites while routing.\n", + "\n", + "The challenge here is to prepare the data appropriately and construct a reasonable GET request.\n", + "\n", + "[directions]: https://openrouteservice.org/dev/#/api-docs/directions" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import folium\n", + "import pyproj\n", + "import requests\n", + "import openrouteservice as ors\n", + "from shapely import geometry\n", + "from shapely.geometry import Point, LineString, Polygon, MultiPolygon" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Rostock is beautiful, but, as in most other pan-European cities, there are a lot of construction sites.\n", + "Wouldn't it be great if we could plan our trip avoiding these sites and consequently save lots of time!?" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Construction sites in Rostock" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We take the [open data](https://www.opendata-hro.de/de/dataset/baustellen) from the Rostock authorities.\n", + "It's hard (to impossible) to find construction site polygons, so these are points, and we need to buffer them to\n", + "a polygon to be able to avoid them when they cross a street.\n", + "\n", + "For the investigatory in you: yes, no CRS is specified on the link (shame on you, Rostock!).\n", + "It's fair enough to assume it comes in WGS84 lat/long though (my reasoning:\n", + "they show Leaflet maps plus GeoJSON is generally a web exchange format, and many web clients (Google Maps, Leaflet)\n", + "won't take CRS other than WGS84).\n", + "Since degrees are not the most convenient unit to work with, let's first define a function which does the buffering job\n", + "with UTM32N projected coordinates:" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "url = 'https://geo.sv.rostock.de/download/opendata/baustellen/baustellen.json'\n", + "\n", + "\n", + "def create_buffer_polygon(point_in, resolution=10, radius=10):\n", + " convert = pyproj.Transformer.from_crs(\"epsg:4326\", 'epsg:32632') # WGS84 to UTM32N\n", + " convert_back = pyproj.Transformer.from_crs('epsg:32632', \"epsg:4326\") # UTM32N to WGS84\n", + " point_in_proj = convert.transform(*point_in)\n", + " point_buffer_proj = Point(point_in_proj).buffer(radius, resolution=resolution) # 10 m buffer\n", + "\n", + " # Iterate over all points in buffer and build polygon\n", + " poly_wgs = []\n", + " for point in point_buffer_proj.exterior.coords:\n", + " poly_wgs.append(convert_back.transform(*point)) # Transform back to WGS84\n", + "\n", + " return poly_wgs" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Set up the fundamentals\n", + "api_key = 'your-api-key' # Individual api key\n", + "\n", + "rostock_json = requests.get(url).json() # Get data as JSON\n", + "\n", + "map_params = {'tiles': 'Stamen Toner',\n", + " 'location': ([54.13207, 12.101612]),\n", + " 'zoom_start': 12}\n", + "map1 = folium.Map(**map_params)\n", + "\n", + "# Populate a construction site buffer polygon list\n", + "sites_poly = []\n", + "for site_data in rostock_json['features']:\n", + " site_coords = site_data['geometry']['coordinates']\n", + " folium.features.Marker(list(reversed(site_coords)),\n", + " popup='Construction point
{0}'.format(site_coords)).add_to(map1)\n", + "\n", + " # Create buffer polygons around construction sites with 10 m radius and low resolution\n", + " site_poly_coords = create_buffer_polygon(site_coords,\n", + " resolution=2, # low resolution to keep polygons lean\n", + " radius=10)\n", + " sites_poly.append(site_poly_coords)\n", + "\n", + " site_poly_coords = [(y, x) for x, y in site_poly_coords] # Reverse coords for folium/Leaflet\n", + " folium.vector_layers.Polygon(locations=site_poly_coords,\n", + " color='#ffd699',\n", + " fill_color='#ffd699',\n", + " fill_opacity=0.2,\n", + " weight=3).add_to(map1)\n", + "\n", + "map1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "That's a lot of construction sites in Rostock! If you dig into the `properties` of the JSON, you'll see that those\n", + "are kept up-to-date though. Seems like an annoying place to ride a car...\n", + "\n", + "Anyways, as you might know, a GET request can only contain so many characters. Unfortunately, > 80 polygons are more\n", + "than a GET can take (that's why we set `resolution = 2`).\n", + "Because there's no POST endpoint available currently, we'll have to work around it:\n", + "\n", + "One sensible thing one could do, is to eliminate construction zones which are not in the immediate surrounding of the\n", + "route of interest.\n", + "Hence, we can request a route without construction sites, take a reasonable buffer,\n", + "filter construction sites within the buffer and try again.\n", + "\n", + "Let's try this:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# GeoJSON style function\n", + "def style_function(color):\n", + " return lambda feature: dict(color=color,\n", + " weight=3,\n", + " opacity=0.5)\n", + "\n", + "\n", + "# Create new map to start from scratch\n", + "map_params.update({'location': ([54.091389, 12.096686]),\n", + " 'zoom_start': 13})\n", + "map2 = folium.Map(**map_params)\n", + "\n", + "api_instance = ors.DirectionsServiceApi(ors.apiClient(apiKey=api_key))\n", + "body = ors.DirectionsServiceBody(\n", + " coordinates=[[12.108259, 54.081919],[12.072063, 54.103684]],\n", + " preference='shortest',\n", + " instructions=False\n", + ")\n", + "api_response = api_instance.get_geo_json_route(body, 'driving-car')\n", + "route_normal = ors.todict(api_response)\n", + "\n", + "\n", + "folium.features.GeoJson(data=route_normal,\n", + " name='Route without construction sites',\n", + " style_function=style_function('#FF0000'),\n", + " overlay=True).add_to(map2)\n", + "\n", + "# Buffer route with 0.009 degrees (really, just too lazy to project again...)\n", + "route_buffer = LineString(route_normal['features'][0]['geometry']['coordinates']).buffer(0.009)\n", + "folium.features.GeoJson(data=geometry.mapping(route_buffer),\n", + " name='Route Buffer',\n", + " style_function=style_function('#FFFF00'),\n", + " overlay=True).add_to(map2)\n", + "\n", + "# Plot which construction sites fall into the buffer Polygon\n", + "sites_buffer_poly = []\n", + "for site_poly in sites_poly:\n", + " poly = Polygon(site_poly)\n", + " if route_buffer.intersects(poly):\n", + " folium.features.Marker(list(reversed(poly.centroid.coords[0]))).add_to(map2)\n", + " sites_buffer_poly.append(poly)\n", + "\n", + "map2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally, we can try to request a route using `avoid_polygons`, which conveniently takes a GeoJSON as input." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Add the site polygons to the request parameters\n", + "body = ors.DirectionsServiceBody(\n", + " coordinates=[[12.108259, 54.081919],[12.072063, 54.103684]],\n", + " preference='shortest',\n", + " instructions=False,\n", + " options={'avoid_polygons': geometry.mapping(MultiPolygon(sites_buffer_poly)),}\n", + ")\n", + "\n", + "api_response = api_instance.get_geo_json_route(body, 'driving-car')\n", + "route_detour = ors.todict(api_response)\n", + "\n", + "folium.features.GeoJson(data=route_detour,\n", + " name='Route with construction sites',\n", + " style_function=style_function('#00FF00'),\n", + " overlay=True).add_to(map2)\n", + "\n", + "map2.add_child(folium.map.LayerControl())\n", + "map2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "> Note: This request might fail sometime in the future, as the JSON is loaded dynamically and changes a few times\n", + "> a week.\n", + "> Thus the amount of sites within the buffer can exceed the GET limit (which is between 15-20 site polygons approx)." + ] + } + ], + "metadata": { + "jupytext": { + "formats": "ipynb,py:light" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/examples/Dieselgate_Routing.ipynb b/examples/Dieselgate_Routing.ipynb new file mode 100644 index 00000000..4d466774 --- /dev/null +++ b/examples/Dieselgate_Routing.ipynb @@ -0,0 +1,969 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "58981b12", + "metadata": {}, + "source": [ + "# Dieselgate Routing\n", + "\n", + "> Note: All notebooks need the environment dependencies as well as an openrouteservice API key to run\n", + "\n", + "From the year 2019 on, Berlin will impose the Diesel ban. The following streets will be affected: Leipziger Straße, Reinhardstraße, Friedrichstraße, Brückenstraße, Kapweg, Alt-Moabit, Stromstraße und Leonorenstraße.\n", + "\n", + "As a showcase, we'll have a look how the frequent visits of Angela Merkel to the German Currywurst Museum (solely inferred from superficial research) will change its route from 2019. You'll find remarkable similarities." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "a44085a3-bcb8-44ad-9fe1-e283c85a23bd", + "metadata": {}, + "outputs": [], + "source": [ + "import openrouteservice as ors\n", + "import folium\n", + "from shapely.geometry import LineString, mapping\n", + "from shapely.ops import unary_union\n", + "\n", + "def style_function(color): # To style data\n", + " return lambda feature: dict(color=color, opacity=0.5, weight=4)" + ] + }, + { + "cell_type": "markdown", + "id": "804b121c", + "metadata": {}, + "source": [ + "### Regular route\n", + "So far: The shortest route for a car from A to B." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "12164e5b-fa76-41ad-b217-03710b09fecd", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Basic parameters\n", + "api_key = 'your-api-key' # https://openrouteservice.org/sign-up\n", + "directionsApi = ors.DirectionsServiceApi(ors.apiClient(apiKey=api_key))\n", + "\n", + "\n", + "map_berlin = folium.Map(tiles='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',\n", + " attr='© OpenStreetMap contributors',\n", + " location=([52.516586, 13.381047]),\n", + " zoom_start=13.5) # Create map\n", + "\n", + "popup_route = \"

{0} route


\" \\\n", + " \"Duration: {1:.1f} mins
\" \\\n", + " \"Distance: {2:.3f} km\"\n", + "\n", + "\n", + "# Request route\n", + "coordinates = [[13.372582, 52.520295], [13.391476, 52.508856]]\n", + "body = ors.DirectionsServiceBody(\n", + " coordinates=coordinates,\n", + " preference='shortest',\n", + " geometry=True\n", + ")\n", + "profile = 'driving-car'\n", + "regular_route = directionsApi.get_geo_json_route(body, profile)\n", + "\n", + "# Build popup\n", + "distance, duration = regular_route[\"features\"][0]['properties']['summary'].values()\n", + "popup = folium.map.Popup(popup_route.format('Regular',\n", + " duration / 60,\n", + " distance / 1000))\n", + "regular_route = ors.todict(regular_route)\n", + "\n", + "gj = folium.GeoJson(regular_route,\n", + " name='Regular Route',\n", + " style_function=style_function('blue')\n", + " ).add_child(popup).add_to(map_berlin)\n", + "\n", + "folium.Marker(list(reversed(coordinates[0])), popup='Bundeskanzleramt').add_to(map_berlin)\n", + "folium.Marker(list(reversed(coordinates[1])), popup='Deutsches Currywurst Museum').add_to(map_berlin)\n", + "map_berlin" + ] + }, + { + "cell_type": "markdown", + "id": "54ece891-2853-43f3-b257-6fd2c46fd5fd", + "metadata": {}, + "source": [ + "### Dieselgate Routing\n", + "\n", + "Coming soon: The shortest route for a Diesel driver, which must avoid the blackish areas. Then, affected cars can't cross Friedrichstraße anymore. See for yourself:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "ebb1aee4-7e32-4e4f-ac79-a2e9e2fdac50", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "avoid_streets = [{'name': 'Friedrichstraße', 'coords': [[13.390478, 52.506805], [13.387141, 52.52696]]},\n", + " {'name': 'Leiziger Straße', 'coords': [[13.377807, 52.509587], [13.401142, 52.511291]]},\n", + " {'name': 'Brückenstraße', 'coords': [[13.416549, 52.511141], [13.417686, 52.513531]]},\n", + " {'name': 'Alt-Moabit', 'coords': [[13.327618, 52.524322], [13.367872, 52.522325]]},\n", + " {'name': 'Stromstraße', 'coords': [[13.342155, 52.523474], [13.343239, 52.531555]]}]\n", + "\n", + "# Affected streets\n", + "buffer = []\n", + "for street in avoid_streets:\n", + " body = ors.DirectionsServiceBody(\n", + " coordinates=street['coords'],\n", + " preference='shortest',\n", + " geometry=True\n", + " )\n", + " profile = 'driving-car'\n", + " avoid_request = directionsApi.get_geo_json_route(body, profile)\n", + "\n", + "\n", + " coords = avoid_request[\"features\"][0]['geometry']['coordinates']\n", + " route_buffer = LineString(coords).buffer(0.0005) # Create geometry buffer\n", + " folium.vector_layers.Polygon([(y, x) for x, y in list(route_buffer.exterior.coords)],\n", + " color=('#FF0000'),\n", + " popup=street['name'], ).add_to(map_berlin)\n", + " simp_geom = route_buffer.simplify(0.005) # Simplify geometry for better handling\n", + " buffer.append(simp_geom)\n", + "union_buffer = unary_union(buffer)\n", + "map_berlin" + ] + }, + { + "cell_type": "markdown", + "id": "57c79f13-0e4e-4fa5-99fd-489a642caa29", + "metadata": {}, + "source": [ + "If they are serious about it, this will be the route while avoiding the banned areas:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "259148f3-1b78-4236-96cf-705f55343dfa", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "body = ors.DirectionsServiceBody(\n", + " coordinates=coordinates,\n", + " preference='shortest',\n", + " instructions=False,\n", + " options={'avoid_polygons': mapping(union_buffer)}\n", + ")\n", + "profile = 'driving-car'\n", + "route_diesel = directionsApi.get_geo_json_route(body, profile)\n", + "\n", + "\n", + "# Build popup\n", + "distance, duration = route_diesel[\"features\"][0]['properties']['summary'].values()\n", + "popup = folium.map.Popup(popup_route.format('Diesel Route',\n", + " duration / 60,\n", + " distance / 1000))\n", + "\n", + "folium.GeoJson(route_diesel,\n", + " style_function=style_function('black'),\n", + " name='Route after Jan 2019').add_child(popup).add_to(map_berlin)\n", + "\n", + "map_berlin.add_child(folium.map.LayerControl())" + ] + }, + { + "cell_type": "markdown", + "id": "f1648ced", + "metadata": {}, + "source": [ + "Now, here it should be noted, that our dear Chancellor would have to drive a detour of more than **1.5 times** the current distance, imposing 50% more pollution on Berlin's residents, just to enjoy the history of the Currywurst. Click on the routes to see for yourself.\n", + "\n", + "At least Friedrichstraße is safe soon!\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples/Routing_Optimization_Idai.ipynb b/examples/Routing_Optimization_Idai.ipynb new file mode 100644 index 00000000..e3cd801e --- /dev/null +++ b/examples/Routing_Optimization_Idai.ipynb @@ -0,0 +1,1833 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Routing optimization in a humanitarian context\n", + "> Note: All notebooks need the [environment dependencies](https://github.com/GIScience/openrouteservice-examples#local-installation)\n", + "> as well as an [openrouteservice API key](https://openrouteservice.org/dev/#/signup) to run\n", + "\n", + "Routing optimization generally solves the [Vehicle Routing Problem](https://en.wikipedia.org/wiki/Vehicle_routing_problem)\n", + "(a simple example being the more widely known [Traveling Salesman Problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem)).\n", + "A more complex example would be the distribution of goods by a fleet of multiple vehicles to dozens of locations,\n", + "where each vehicle has certain time windows in which it can operate and each delivery location has certain time windows\n", + "in which it can be served (e.g. opening times of a supermarket).\n", + "\n", + "In this example we'll look at a real-world scenario of **distributing medical goods during disaster response**\n", + "following one of the worst tropical cyclones ever been recorded in Africa: **Cyclone Idai**.\n", + "\n", + "![Cyclone Idai second landfall](https://openrouteservice.org/wp-content/uploads/2017/07/idai_flooding_satellite.jpeg \"Copernicus Sentinel-1 -satellite (modified Copernicus Sentinel data (2019), processed by ESA, CC BY-SA 3.0 IGO)\")\n", + "*Cyclone Idai floods in false color image on 19.03.2019; © Copernicus Sentinel-1 -satellite (modified Copernicus Sentinel data (2019), processed by ESA, CC BY-SA 3.0 IGO), [source](http://www.esa.int/spaceinimages/Images/2019/03/Floods_imaged_by_Copernicus_Sentinel-1)*\n", + "\n", + "In this scenario, a humanitarian organization shipped much needed medical goods to Beira, Mozambique, which were then\n", + "dispatched to local vehicles to be delivered across the region.\n", + "The supplies included vaccinations and medications for water-borne diseases such as Malaria and Cholera,\n", + "so distribution efficiency was critical to contain disastrous epidemics.\n", + "\n", + "We'll solve this complex problem with the **optimization** endpoint of [openrouteservice](https://openrouteservice.org)." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import folium\n", + "from folium.plugins import BeautifyIcon\n", + "import pandas as pd\n", + "import openrouteservice as ors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## The logistics setup\n", + "\n", + "In total 20 sites were identified in need of the medical supplies, while 3 vehicles were scheduled for delivery.\n", + "Let's assume there was only one type of goods, e.g. standard moving boxes full of one medication.\n", + "(In reality there were dozens of different good types, which can be modelled with the same workflow,\n", + "but that'd unnecessarily bloat this example).\n", + "\n", + "The **vehicles** were all located in the port of Beira and had the same following constraints:\n", + "\n", + "- operation time windows from 8:00 to 20:00\n", + "- loading capacity of 300 *[arbitrary unit]*\n", + "\n", + "The **delivery locations** were mostly located in the Beira region, but some extended ~ 200 km to the north of Beira.\n", + "Their needs range from 10 to 148 units of the arbitrary medication goods\n", + "(consult the file located at `../resources/data/idai_health_sites.csv`). Let's look at it in a map." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# First define the map centered around Beira\n", + "m = folium.Map(location=[-18.63680, 34.79430], tiles='cartodbpositron', zoom_start=8)\n", + "\n", + "# Next load the delivery locations from CSV file at ../resources/data/idai_health_sites.csv\n", + "# ID, Lat, Lon, Open_From, Open_To, Needed_Amount\n", + "deliveries_data = pd.read_csv(\n", + " 'data/idai_health_sites.csv',\n", + " index_col=\"ID\",\n", + " parse_dates=[\"Open_From\", \"Open_To\"]\n", + ")\n", + " \n", + "\n", + "# Plot the locations on the map with more info in the ToolTip\n", + "for location in deliveries_data.itertuples():\n", + " tooltip = folium.map.Tooltip(\"

ID {}

Supplies needed: {}

\".format(\n", + " location.Index, location.Needed_Amount\n", + " ))\n", + "\n", + " folium.Marker(\n", + " location=[location.Lat, location.Lon],\n", + " tooltip=tooltip,\n", + " icon=BeautifyIcon(\n", + " icon_shape='marker',\n", + " number=int(location.Index),\n", + " spin=True,\n", + " text_color='red',\n", + " background_color=\"#FFF\",\n", + " inner_icon_style=\"font-size:12px;padding-top:-5px;\"\n", + " )\n", + " ).add_to(m)\n", + "\n", + "# The vehicles are all located at the port of Beira\n", + "depot = [-19.818474, 34.835447]\n", + "\n", + "folium.Marker(\n", + " location=depot,\n", + " icon=folium.Icon(color=\"green\", icon=\"bus\", prefix='fa'),\n", + " setZIndexOffset=1000\n", + ").add_to(m)\n", + "\n", + "m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## The routing problem setup\n", + "\n", + "Now that we have described the setup sufficiently, we can start to set up our actual Vehicle Routing Problem.\n", + "For this example we're using the FOSS library of [Vroom](https://github.com/VROOM-Project/vroom), which has\n", + "[recently seen](http://k1z.blog.uni-heidelberg.de/2019/01/24/solve-routing-optimization-with-vroom-ors/) support for\n", + "openrouteservice and is available through our APIs.\n", + "\n", + "To properly describe the problem in algorithmic terms, we have to provide the following information:\n", + "\n", + "- **vehicles start/end address**: vehicle depot in Beira's port\n", + "- **vehicle capacity**: 300\n", + "- **vehicle operational times**: 08:00 - 20:00\n", + "- **service location**: delivery location\n", + "- **service time windows**: individual delivery location's time window\n", + "- **service amount**: individual delivery location's needs\n", + "\n", + "We defined all these parameters either in code above or in the data sheet located in\n", + "`../resources/data/idai_health_sites.csv`.\n", + "Now we have to only wrap this information into our code and send a request to openrouteservice optimization service at\n", + "[`https://api.openrouteservice.org/optimization`](https://openrouteservice.org/dev/#/api-docs/optimization/post)." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# Define the vehicles\n", + "# https://openrouteservice-py.readthedocs.io/en/latest/openrouteservice.html#openrouteservice.optimization.Vehicle\n", + "vehicles = list()\n", + "for idx in range(3):\n", + " vehicles.append(\n", + " ors.OptimizationVehicles(\n", + " id=idx,\n", + " start=list(reversed(depot)),\n", + " profile='driving-car',\n", + " # end=list(reversed(depot)),\n", + " capacity=[300],\n", + " time_window=[1553241600, 1553284800] # Fri 8-20:00, expressed in POSIX timestamp\n", + " )\n", + " )\n", + "\n", + "# Next define the delivery stations\n", + "# https://openrouteservice-py.readthedocs.io/en/latest/openrouteservice.html#openrouteservice.optimization.Job\n", + "deliveries = list()\n", + "for delivery in deliveries_data.itertuples():\n", + " deliveries.append(\n", + " ors.OptimizationJobs(\n", + " id=delivery.Index,\n", + " location=[delivery.Lon, delivery.Lat],\n", + " service=1200, # Assume 20 minutes at each site\n", + " delivery=[delivery.Needed_Amount],\n", + " time_windows=[[\n", + " int(delivery.Open_From.timestamp()), # VROOM expects UNIX timestamp\n", + " int(delivery.Open_To.timestamp())\n", + " ]]\n", + " )\n", + " )" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "With that set up we can now perform the actual request and let openrouteservice calculate the optimal vehicle schedule\n", + "for all deliveries." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Initialize a client and make the request\n", + "api_key = \"your-api-key\"\n", + "optimizationApi = ors.OptimizationApi(ors.apiClient(apiKey=api_key))\n", + "body = ors.OptimizationBody(\n", + " jobs=deliveries,\n", + " vehicles=vehicles,\n", + " options=ors.OptimizationOptions(g=True)\n", + ")\n", + "\n", + "result = optimizationApi.optimization_post(body)\n", + "\n", + "# Add the output to the map\n", + "for color, route in zip(['green', 'red', 'blue'], result[\"routes\"]):\n", + " gj = folium.GeoJson(\n", + " name='Vehicle {}'.format(route[\"vehicle\"]),\n", + " data={\"type\": \"FeatureCollection\", \"features\": [{\"type\": \"Feature\",\n", + " \"geometry\": ors.decode_polyline(route[\"geometry\"]),\n", + " \"properties\": {\"color\": color}\n", + " }]},\n", + " style_function=lambda x: {\"color\": x['properties']['color']}\n", + " )\n", + " gj.add_child(folium.Tooltip(\n", + " \"\"\"

Vehicle {vehicle}

\n", + " Distance {distance} m
\n", + " Duration {duration} secs\n", + " \"\"\".format(**ors.todict(route))\n", + " ))\n", + " gj.add_to(m)\n", + "\n", + "folium.LayerControl().add_to(m)\n", + "m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Data view\n", + "\n", + "Plotting it on a map is nice, but let's add a little more context to it in form of data tables.\n", + "First the overall trip schedule:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Overall schedule" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
distanceamountduration
vehicle
0339333[299]25798
1474543[295]23615
2473790[286]28710
\n", + "
" + ], + "text/plain": [ + " distance amount duration\n", + "vehicle \n", + "0 339333 [299] 25798\n", + "1 474543 [295] 23615\n", + "2 473790 [286] 28710" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Only extract relevant fields from the response\n", + "extract_fields = ['distance', 'amount', 'duration']\n", + "data = [{key: route[key] for key in extract_fields} for route in result[\"routes\"]]\n", + "\n", + "vehicles_df = pd.DataFrame(data)\n", + "vehicles_df.index.name = 'vehicle'\n", + "vehicles_df" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "So every vehicle's capacity is almost fully exploited. That's good.\n", + "How about a look at the individual service stations:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "# Create a list to display the schedule for all vehicles\n", + "stations = list()\n", + "for route in result[\"routes\"]:\n", + " vehicle = list()\n", + " for step in route[\"steps\"]:\n", + " vehicle.append(\n", + " [\n", + " step[\"job\"] if \"job\" in step else \"Depot\", # Station ID\n", + " step[\"arrival\"], # Arrival time\n", + " step[\"arrival\"] + (step[\"service\"] if step[\"service\"] else 0), # Departure time\n", + "\n", + " ]\n", + " )\n", + " stations.append(vehicle)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now we can look at each individual vehicle's timetable:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Vehicle 0" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Station IDArrivalDeparture
0Depot2019-03-22 08:07:312019-03-22 08:07:31
152019-03-22 08:20:232019-03-22 08:40:23
242019-03-22 08:45:102019-03-22 09:05:10
362019-03-22 09:19:102019-03-22 09:39:10
4142019-03-22 10:00:002019-03-22 10:20:00
5102019-03-22 10:50:582019-03-22 11:10:58
682019-03-22 12:47:162019-03-22 13:07:16
7172019-03-22 14:58:302019-03-22 15:18:30
812019-03-22 17:37:292019-03-22 17:57:29
9Depot2019-03-22 17:57:292019-03-22 17:57:29
\n", + "
" + ], + "text/plain": [ + " Station ID Arrival Departure\n", + "0 Depot 2019-03-22 08:07:31 2019-03-22 08:07:31\n", + "1 5 2019-03-22 08:20:23 2019-03-22 08:40:23\n", + "2 4 2019-03-22 08:45:10 2019-03-22 09:05:10\n", + "3 6 2019-03-22 09:19:10 2019-03-22 09:39:10\n", + "4 14 2019-03-22 10:00:00 2019-03-22 10:20:00\n", + "5 10 2019-03-22 10:50:58 2019-03-22 11:10:58\n", + "6 8 2019-03-22 12:47:16 2019-03-22 13:07:16\n", + "7 17 2019-03-22 14:58:30 2019-03-22 15:18:30\n", + "8 1 2019-03-22 17:37:29 2019-03-22 17:57:29\n", + "9 Depot 2019-03-22 17:57:29 2019-03-22 17:57:29" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_stations_0 = pd.DataFrame(stations[0], columns=[\"Station ID\", \"Arrival\", \"Departure\"])\n", + "df_stations_0['Arrival'] = pd.to_datetime(df_stations_0['Arrival'], unit='s')\n", + "df_stations_0['Departure'] = pd.to_datetime(df_stations_0['Departure'], unit='s')\n", + "df_stations_0" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Vehicle 1" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Station IDArrivalDeparture
0Depot2019-03-22 09:44:182019-03-22 09:44:18
172019-03-22 10:00:002019-03-22 10:20:00
2122019-03-22 10:58:472019-03-22 11:18:47
3132019-03-22 11:32:042019-03-22 11:52:04
4202019-03-22 17:17:532019-03-22 17:37:53
5Depot2019-03-22 17:37:532019-03-22 17:37:53
\n", + "
" + ], + "text/plain": [ + " Station ID Arrival Departure\n", + "0 Depot 2019-03-22 09:44:18 2019-03-22 09:44:18\n", + "1 7 2019-03-22 10:00:00 2019-03-22 10:20:00\n", + "2 12 2019-03-22 10:58:47 2019-03-22 11:18:47\n", + "3 13 2019-03-22 11:32:04 2019-03-22 11:52:04\n", + "4 20 2019-03-22 17:17:53 2019-03-22 17:37:53\n", + "5 Depot 2019-03-22 17:37:53 2019-03-22 17:37:53" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_stations_1 = pd.DataFrame(stations[1], columns=[\"Station ID\", \"Arrival\", \"Departure\"])\n", + "df_stations_1['Arrival'] = pd.to_datetime(df_stations_1['Arrival'], unit='s')\n", + "df_stations_1['Departure'] = pd.to_datetime(df_stations_1['Departure'], unit='s')\n", + "df_stations_1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Vehicle 2" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Station IDArrivalDeparture
0Depot2019-03-22 08:00:002019-03-22 08:00:00
132019-03-22 08:16:302019-03-22 08:36:30
222019-03-22 08:42:012019-03-22 09:02:01
3182019-03-22 09:14:252019-03-22 09:34:25
4112019-03-22 09:57:352019-03-22 10:17:35
592019-03-22 11:01:412019-03-22 11:21:41
6162019-03-22 16:58:402019-03-22 17:18:40
7152019-03-22 17:58:302019-03-22 18:18:30
8Depot2019-03-22 18:18:302019-03-22 18:18:30
\n", + "
" + ], + "text/plain": [ + " Station ID Arrival Departure\n", + "0 Depot 2019-03-22 08:00:00 2019-03-22 08:00:00\n", + "1 3 2019-03-22 08:16:30 2019-03-22 08:36:30\n", + "2 2 2019-03-22 08:42:01 2019-03-22 09:02:01\n", + "3 18 2019-03-22 09:14:25 2019-03-22 09:34:25\n", + "4 11 2019-03-22 09:57:35 2019-03-22 10:17:35\n", + "5 9 2019-03-22 11:01:41 2019-03-22 11:21:41\n", + "6 16 2019-03-22 16:58:40 2019-03-22 17:18:40\n", + "7 15 2019-03-22 17:58:30 2019-03-22 18:18:30\n", + "8 Depot 2019-03-22 18:18:30 2019-03-22 18:18:30" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_stations_2 = pd.DataFrame(stations[2], columns=[\"Station ID\", \"Arrival\", \"Departure\"])\n", + "df_stations_2['Arrival'] = pd.to_datetime(df_stations_2['Arrival'], unit='s')\n", + "df_stations_2['Departure'] = pd.to_datetime(df_stations_2['Departure'], unit='s')\n", + "df_stations_2" + ] + } + ], + "metadata": { + "jupytext": { + "encoding": "# -*- coding: utf-8 -*-", + "formats": "ipynb,py:light" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.6" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": true, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": true + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/examples/basic_example.ipynb b/examples/basic_example.ipynb deleted file mode 100644 index e226e6b9..00000000 --- a/examples/basic_example.ipynb +++ /dev/null @@ -1,596 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Simple `openrouteservice-py` examples\n", - "\n", - "This notebook is just a small reference on how to use `openrouteservice` package to request:\n", - "- [directions](https://openrouteservice.org/dev)\n", - "- [isochrones](https://openrouteservice.org/dev/#/api-docs/v2/isochrones/{profile}/post)\n", - "- [matrix](https://openrouteservice.org/dev/#/api-docs/v2/matrix/{profile}/post)\n", - "- [POIs](https://openrouteservice.org/dev/#/api-docs/pois/post)\n", - "- [Elevation](https://openrouteservice.org/dev/#/api-docs/elevation/line/post)\n", - "- [Route Optimization](https://openrouteservice.org/dev/#/api-docs/optimization/post)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "import openrouteservice as ors\n", - "import folium\n", - "\n", - "client = ors.Client(key='')" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## TOC\n", - "\n", - "- **[Directions](#Directions)**\n", - "- **[Isochrones](#Isochrones)**\n", - "- **[Matrix](#Matrix)**\n", - "- **[POIs](#POIs)**\n", - "- **[Geocoding](#Geocoding)**\n", - "- **[Elevation](#Elevation)**\n", - "- **[Optimization](#Optimization)**" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Directions" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map(location=[52.521861, 13.40744], tiles='cartodbpositron', zoom_start=13)\n", - "\n", - "# Some coordinates in Berlin\n", - "coordinates = [[13.42731, 52.51088], [13.384116, 52.533558]]\n", - "\n", - "route = client.directions(\n", - " coordinates=coordinates,\n", - " profile='foot-walking',\n", - " format='geojson',\n", - " options={\"avoid_features\": [\"steps\"]},\n", - " validate=False,\n", - ")\n", - "folium.PolyLine(locations=[list(reversed(coord)) \n", - " for coord in \n", - " route['features'][0]['geometry']['coordinates']]).add_to(m)\n", - " \n", - "m" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Isochrones" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map(location=[52.521861, 13.40744], tiles='cartodbpositron', zoom_start=13)\n", - "\n", - "# Some coordinate in Berlin\n", - "coordinate = [[13.384116, 52.533558]]\n", - "\n", - "iso = client.isochrones(\n", - " locations=coordinate,\n", - " profile='foot-walking',\n", - " range=[600, 1200],\n", - " validate=False,\n", - " attributes=['total_pop']\n", - ")\n", - "\n", - "# Also create a Popup with Population count within isochrones\n", - "for isochrone in iso['features']:\n", - " folium.Polygon(locations=[list(reversed(coord)) for coord in isochrone['geometry']['coordinates'][0]],\n", - " fill='00ff00',\n", - " popup=folium.Popup(\"Population: {} people\".format(isochrone['properties']['total_pop'])),\n", - " opacity=0.5).add_to(m)\n", - " \n", - "m" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Matrix" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Durations in secs: [[0.0, 2741.09, 3790.1, 3730.45], [2741.09, 0.0, 2005.62, 3971.36], [3790.1, 2005.62, 0.0, 2644.38], [3730.45, 3971.36, 2644.38, 0.0]]\n", - "\n", - "Distances in m: [[0.0, 3807.14, 5264.14, 5181.27], [3807.14, 0.0, 2785.65, 5515.87], [5264.14, 2785.65, 0.0, 3672.82], [5181.27, 5515.87, 3672.82, 0.0]]\n" - ] - }, - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map(location=[52.521861, 13.40744], tiles='cartodbpositron', zoom_start=13)\n", - "\n", - "# Some coordinates in Berlin\n", - "coordinates = [[13.384116, 52.533558], [13.428726, 52.519355], [13.41774, 52.498929], [13.374825, 52.496369]]\n", - "\n", - "matrix = client.distance_matrix(\n", - " locations=coordinates,\n", - " profile='foot-walking',\n", - " metrics=['distance', 'duration'],\n", - " validate=False,\n", - ")\n", - "\n", - "for marker in coordinates:\n", - " folium.Marker(location=list(reversed(marker))).add_to(m)\n", - "\n", - "print(\"Durations in secs: {}\\n\".format(matrix['durations']))\n", - "print(\"Distances in m: {}\".format(matrix['distances']))\n", - "\n", - "m" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## POIs" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map(location=[52.521861, 13.40744], tiles='cartodbpositron', zoom_start=13)\n", - "\n", - "# Some coordinates in Berlin\n", - "geojson = {\"type\": \"point\", \"coordinates\": [13.384116, 52.533558]}\n", - "\n", - "pois = client.places(\n", - " request='pois',\n", - " geojson=geojson,\n", - " buffer=500, # searches within 500 meters of specified point\n", - " filter_category_ids=[561, 568], # https://github.com/GIScience/openpoiservice/blob/master/openpoiservice/server/categories/categories.yml\n", - " validate=False,\n", - "# dry_run=True\n", - ")\n", - "\n", - "for poi in pois[0]['features']: \n", - " folium.Marker(\n", - " location=list(reversed(poi['geometry']['coordinates'])),\n", - " icon=folium.Icon(icon='info-sign'),\n", - " popup=folium.Popup(poi['properties'].get('osm_tags', {}).get('name', \"Bar ohne Namen\")),\n", - " ).add_to(m)\n", - " \n", - "m" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Geocoding" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Forward Geocoding" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map(location=[52.521861, 13.40744], tiles='cartodbpositron', zoom_start=13)\n", - "\n", - "address = \"Mollstraße 1, Berlin\"\n", - "\n", - "geocode = client.pelias_search(\n", - " text=address,\n", - " focus_point=list(reversed(m.location)),\n", - " validate=False,\n", - ")\n", - "\n", - "for result in geocode['features']:\n", - " folium.Marker(\n", - " location=list(reversed(result['geometry']['coordinates'])),\n", - " icon=folium.Icon(icon='compass', color='green', prefix='fa'),\n", - " popup=folium.Popup(result['properties']['name'])\n", - " ).add_to(m)\n", - "\n", - "m" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Reverse Geocoding" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map(location=[52.521861, 13.40744], tiles='cartodbpositron', zoom_start=13)\n", - "\n", - "coordinate = [13.413448, 52.490993]\n", - "\n", - "reverse = client.pelias_reverse(\n", - " point=coordinate,\n", - " validate=False,\n", - ")\n", - "\n", - "for result in reverse['features']:\n", - " folium.Marker(\n", - " location=list(reversed(result['geometry']['coordinates'])),\n", - " icon=folium.Icon(icon='history', color='green', prefix='fa'),\n", - " popup=folium.Popup(result['properties']['label'])\n", - " ).add_to(m)\n", - "\n", - "m" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Elevation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Point" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[13.384116, 52.533558, 34.0]\n" - ] - } - ], - "source": [ - "coordinate = [13.384116, 52.533558]\n", - "\n", - "elevation = client.elevation_point(\n", - " format_in='point',\n", - " format_out='point',\n", - " geometry=coordinate\n", - ")\n", - "\n", - "print(elevation['geometry'])" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Line" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[[13.384116, 52.533558, 34], [13.428726, 52.519355, 40], [13.41774, 52.498929, 40], [13.374825, 52.496369, 39]]\n" - ] - } - ], - "source": [ - "coordinates = [[13.384116, 52.533558], [13.428726, 52.519355], [13.41774, 52.498929], [13.374825, 52.496369]]\n", - "\n", - "elevation = client.elevation_line(\n", - " format_in='polyline', # other options: geojson, encodedpolyline\n", - " format_out='geojson',\n", - " geometry=coordinates,\n", - ")\n", - "\n", - "print(elevation['geometry']['coordinates'])" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Optimization" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Simple waypoint optimization" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "With `openrouteservice-py` you can ask for waypoint optimization when requesting a normal `direction`. This assumes that your first coordinate is the start location and the last coordinate is the end location, i.e. only the `via` endpoints are optimized. To make it a round trip, make the first and last location the same." - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "scrolled": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map(location=[52.521861, 13.40744], tiles='cartodbpositron', zoom_start=13)\n", - "\n", - "# Some coordinates in Berlin\n", - "coordinates = [[13.384116, 52.533558], [13.41774, 52.498929], [13.428726, 52.519355], [13.374825, 52.496369]]\n", - "\n", - "# The popup will show the ID in the coordinate list. In a non-optimized waypoint order, the waypoints\n", - "# would have been visited from ID 0 to ID 3 sequentially.\n", - "for idx, coords in enumerate(coordinates):\n", - " folium.Marker(location=list(reversed(coords)),\n", - " popup=folium.Popup(\"ID: {}\".format(idx))).add_to(m)\n", - "\n", - "route = client.directions(\n", - " coordinates=coordinates,\n", - " profile='foot-walking',\n", - " format='geojson',\n", - " validate=False,\n", - " optimize_waypoints=True\n", - ")\n", - "\n", - "folium.PolyLine(locations=[list(reversed(coord)) \n", - " for coord in \n", - " route['features'][0]['geometry']['coordinates']]).add_to(m)\n", - " \n", - "m" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Optimize job scheduling for multiple vehicles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The next example makes more use of the power of the ORS optimization endpoint. Two vehicles are assigned to 6 jobs, where the capacity constraints are such that each vehicle can only carry out 3 jobs on its route." - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map(location=[52.521861, 13.40744], tiles='cartodbpositron', zoom_start=13)\n", - "\n", - "vehicle_locations = [[13.390446, 52.506087], [13.384116, 52.533558]]\n", - "job_locations = [[13.428726, 52.519355],\n", - " [13.41774, 52.498929],\n", - " [13.374825, 52.496369],\n", - " [13.378859, 52.509796],\n", - " [13.400488, 52.509691],\n", - " [13.358517, 52.524264]]\n", - "\n", - "# Assign vehicles to do the jobs\n", - "vehicles = []\n", - "for idx, coords in enumerate(vehicle_locations):\n", - " vehicles.append(ors.optimization.Vehicle(\n", - " id=idx,\n", - " profile='driving-car',\n", - " start=coords,\n", - " end=coords,\n", - " capacity=[3] # Limit capacity so only 3 jobs can be taken by each vehicle\n", - " ))\n", - " folium.Marker(location=list(reversed(coords)), icon=folium.Icon(icon='truck', prefix='fa')).add_to(m)\n", - "\n", - "# Define jobs to be carried out\n", - "jobs=[]\n", - "for idx, coords in enumerate(job_locations):\n", - " jobs.append(ors.optimization.Job(\n", - " id=idx,\n", - " location=coords,\n", - " amount=[1] # Occupies capacity in vehicle\n", - " ))\n", - " folium.Marker(location=list(reversed(coords)), icon=folium.Icon(icon='archive', prefix='fa', color='green')).add_to(m)\n", - "\n", - "optimized = client.optimization(\n", - " jobs=jobs,\n", - " vehicles=vehicles,\n", - " geometry=True, ## will output the geometry,\n", - ")\n", - "\n", - "folium.PolyLine(\n", - " locations=[list(reversed(coords)) for coords in ors.convert.decode_polyline(optimized['routes'][0]['geometry'])['coordinates']],\n", - " color='red'\n", - ").add_to(m)\n", - "\n", - "folium.PolyLine(\n", - " locations=[list(reversed(coords)) for coords in ors.convert.decode_polyline(optimized['routes'][1]['geometry'])['coordinates']],\n", - " color='orange'\n", - ").add_to(m)\n", - "\n", - "m" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.2" - } - }, - "nbformat": 4, - "nbformat_minor": 1 -} diff --git a/examples/data/idai_health_sites.csv b/examples/data/idai_health_sites.csv new file mode 100644 index 00000000..e72b7cdd --- /dev/null +++ b/examples/data/idai_health_sites.csv @@ -0,0 +1,20 @@ +ID,Lon,Lat,Open_From,Open_To,Needed_Amount +1,33.9852423,-19.8202962,2019-03-22 08:00:00,2019-03-22 18:00:00,24 +2,34.8194789,-19.7248894,2019-03-22 08:30:00,2019-03-22 20:00:00,10 +3,34.8472248,-19.7461948,2019-03-22 07:00:00,2019-03-22 17:00:00,48 +4,34.8664597,-19.8314851,2019-03-22 07:30:00,2019-03-22 17:30:00,34 +5,34.8752098,-19.8490298,2019-03-22 06:00:00,2019-03-22 20:00:00,29 +6,34.8605631,-19.7469002,2019-03-22 08:30:00,2019-03-22 18:00:00,77 +7,34.8908967,-19.8017717,2019-03-22 10:00:00,2019-03-22 22:00:00,23 +8,34.5927733,-19.8829819,2019-03-22 08:00:00,2019-03-22 18:00:00,17 +9,34.5748517,-19.3639757,2019-03-22 08:30:00,2019-03-22 20:00:00,82 +10,34.5933026,-19.5030938,2019-03-22 07:00:00,2019-03-22 17:00:00,44 +11,34.6258056,-19.5435948,2019-03-22 07:30:00,2019-03-22 17:30:00,25 +12,34.7173762,-19.6297038,2019-03-22 06:00:00,2019-03-22 20:00:00,148 +13,34.7412184,-19.6181757,2019-03-22 08:30:00,2019-03-22 18:00:00,33 +14,34.7600126,-19.6871573,2019-03-22 10:00:00,2019-03-22 22:00:00,26 +15,34.28176,-17.3176417,2019-03-22 08:00:00,2019-03-22 18:00:00,39 +16,34.309304,-17.5822419,2019-03-22 08:00:00,2019-03-22 18:00:00,50 +17,34.1497002,-20.1497002,2019-03-22 08:30:00,2019-03-22 20:00:00,48 +18,34.7658005,-19.6506004,2019-03-22 07:00:00,2019-03-22 17:00:00,32 +20,35.2468987,-17.7828007,2019-03-22 07:30:00,2019-03-22 17:30:00,91 diff --git a/examples/ortools_pubcrawl.ipynb b/examples/ortools_pubcrawl.ipynb new file mode 100644 index 00000000..b4cc3f3c --- /dev/null +++ b/examples/ortools_pubcrawl.ipynb @@ -0,0 +1,403 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Route optimization of a pub crawl with ORS and `ortools`\n", + "> Note: All notebooks need the [environment dependencies](https://github.com/GIScience/openrouteservice-examples#local-installation)\n", + "> as well as an [openrouteservice API key](https://openrouteservice.org/dev/#/signup) to run" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "It's this of the year again (or will be in 6 months):\n", + "the freshmen pour into the institute and as the diligent student council you are, you want to welcome them for their\n", + "geo adventure with a stately pub crawl to prepare them for the challenges lying ahead.\n", + "\n", + "We want to give you the opportunity to route the pack of rookies in a fairly optimal way:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import folium\n", + "from shapely import wkt, geometry" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now we're ready to start our most optimally planned pub crawl ever through hipster Kreuzberg!\n", + "It will also be the most un-hipster pub crawl ever, as we'll cover ground with a taxi.\n", + "At least it's safer than biking half-delirious.\n", + "\n", + "First the basic parameters: API key and the district polygon to limit our pub search.\n", + "The Well Known Text was prepared in QGIS from Berlin authority's\n", + "[WFS](http://fbinter.stadt-berlin.de/fb/wfs/geometry/senstadt/re_ortsteil/)\n", + "(QGIS field calculator has a `geom_to_wkt` method).\n", + "BTW, Berlin, hope you don't wonder why your feature services are so slow... Simplify is the magic word, simplify." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "wkt_str = 'Polygon ((13.43926404 52.48961046, 13.42040115 52.49586382, 13.42541101 52.48808523, 13.42368155 52.48635829, 13.40788599 52.48886084, 13.40852944 52.487142, 13.40745989 52.48614988, 13.40439187 52.48499746, 13.40154731 52.48500125, 13.40038591 52.48373202, 13.39423818 52.4838664, 13.39425346 52.48577149, 13.38629096 52.48582648, 13.38626853 52.48486362, 13.3715694 52.48495055, 13.37402099 52.4851697, 13.37416365 52.48771105, 13.37353615 52.48798191, 13.37539925 52.489432, 13.37643416 52.49167597, 13.36821531 52.49333093, 13.36952826 52.49886974, 13.37360623 52.50416333, 13.37497726 52.50337776, 13.37764916 52.5079675, 13.37893813 52.50693045, 13.39923153 52.50807711, 13.40022883 52.50938108, 13.40443425 52.50777471, 13.4052848 52.50821063, 13.40802944 52.50618019, 13.40997081 52.50692569, 13.41152096 52.50489127, 13.41407284 52.50403794, 13.41490921 52.50491634, 13.41760145 52.50417013, 13.41943091 52.50564912, 13.4230412 52.50498109, 13.42720031 52.50566607, 13.42940229 52.50857222, 13.45335235 52.49752496, 13.45090795 52.49710803, 13.44765912 52.49472124, 13.44497623 52.49442276, 13.43926404 52.48961046))'\n", + "\n", + "aoi_geom = wkt.loads(wkt_str) # load geometry from WKT string\n", + "\n", + "aoi_coords = list(aoi_geom.exterior.coords) # get coords from exterior ring\n", + "aoi_coords = [(y, x) for x, y in aoi_coords] # swap (x,y) to (y,x). Really leaflet?!\n", + "aoi_centroid = aoi_geom.centroid # Kreuzberg center for map center" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Next, add the Kreuzberg polygon as marker to the map, so we get a bit of orientation." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "m = folium.Map(tiles='Stamen Toner', location=(aoi_centroid.y, aoi_centroid.x), zoom_start=14)\n", + "folium.vector_layers.Polygon(aoi_coords,\n", + " color='#ffd699',\n", + " fill_color='#ffd699',\n", + " fill_opacity=0.2,\n", + " weight=3).add_to(m)\n", + "m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now it's time to see which are the lucky bars to host a bunch of increasingly drunk geos.\n", + "We use the [**Places API**](https://openrouteservice.org/dev/#/api-docs/pois),\n", + "where we can pass a GeoJSON as object right into.\n", + "As we want to crawl only bars and not churches, we have to limit the query to category ID's which represent pubs.\n", + "We can get the mapping easily when passing `category_list`:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import openrouteservice as ors\n", + "\n", + "api_key = \"your-api-key\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[**Here**](https://giscience.github.io/openrouteservice/documentation/Places.html) is a nicer list.\n", + "If you look for pub, you'll find it under `sustenance : 560` with ID 569.\n", + "Chucking that into a query, yields:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "aoi_json = geometry.mapping(geometry.shape(aoi_geom))\n", + "\n", + "poisApi = ors.PoisApi(ors.apiClient(apiKey=api_key))\n", + "body = ors.OpenpoiservicePoiRequest(\n", + " request='pois',\n", + " geometry=ors.PoisGeometry(geojson=aoi_json),\n", + " filters=ors.PoisFilters(category_ids=[569]),\n", + " sortby='distance'\n", + ")\n", + "pubs = poisApi.pois_post(body).features\n", + "\n", + "# Amount of pubs in Kreuzberg\n", + "print(\"\\nAmount of pubs: {}\".format(len(pubs)))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Nearly 100 bars in one night might be a stretch, even for such a resilient species.\n", + "Coincidentally, the rate of smokers is disproportionally high within the undergrad geo community.\n", + "So, we really would like to hang out in smoker bars:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "body.filters.smoking=['yes'] # Filter out smoker bars\n", + "pubs_smoker = poisApi.pois_post(body).features\n", + "\n", + "print(\"\\nAmount of smoker pubs: {}\".format(len(pubs_smoker)))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "A bit better. Let's see where they are.\n", + "\n", + "**Optionally**, use the [**Geocoding API**](https://openrouteservice.org/dev/#/api-docs/geocode) to get representable names.\n", + "Note, it'll be 25 API calls.\n", + "Means, you can only run one per minute." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "pubs_addresses = []\n", + "\n", + "geocodeApi = ors.GeocodeApi(ors.apiClient(apiKey=api_key))\n", + "\n", + "for feat in pubs_smoker:\n", + " lon, lat = feat.geometry.coordinates\n", + " response = geocodeApi.geocode_reverse_get(lon, lat)\n", + " name = response.features[0][\"properties\"][\"name\"]\n", + " popup = \"{0}
Lat: {1:.3f}
Long: {2:.3f}\".format(name, lat, lon)\n", + " icon = folium.map.Icon(color='lightgray',\n", + " icon_color='#b5231a',\n", + " icon='beer', # fetches font-awesome.io symbols\n", + " prefix='fa')\n", + " folium.map.Marker([lat, lon], icon=icon, popup=popup).add_to(m)\n", + " pubs_addresses.append(name)\n", + "\n", + "# folium.map.LayerControl().add_to(m)\n", + "m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Ok, we have an idea where we go.\n", + "But, not in which order.\n", + "To determine the optimal route, we first have to know the distance between all pubs.\n", + "We can conveniently solve this with the [**Matrix API**](https://openrouteservice.org/dev/#/api-docs/matrix).\n", + "> I'd have like to do this example for biking/walking, but I realized too late that we restricted matrix calls to 5x5 locations for those profiles..." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "pubs_coords = [feat.geometry.coordinates for feat in pubs_smoker]\n", + "\n", + "matrixApi = ors.MatrixServiceApi(ors.apiClient(apiKey=api_key))\n", + "body = ors.MatrixProfileBody(\n", + " locations=pubs_coords,\n", + " metrics=['duration']\n", + ")\n", + "profile = 'driving-car'\n", + "\n", + "pubs_matrix = matrixApi.get_default(body, profile)\n", + "\n", + "#pubs_matrix = ors.distance_matrix(**request)\n", + "print(\"Calculated {}x{} routes.\".format(len(pubs_matrix.durations), len(pubs_matrix.durations[0])))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Check, 23x23. So, we got the durations now in `pubs_matrix.durations`.\n", + "Then there's finally the great entrance of [**ortools**](https://github.com/google/or-tools).\n", + "\n", + "Note, this is a local search." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "from ortools.constraint_solver import pywrapcp\n", + "\n", + "tsp_size = len(pubs_addresses)\n", + "num_routes = 1\n", + "start = 0 # arbitrary start location\n", + "coords_aoi = [(y, x) for x, y in aoi_coords] # swap (x,y) to (y,x)\n", + "\n", + "optimal_coords = []\n", + "\n", + "if tsp_size > 0:\n", + "\n", + " # Old Stuff kept for reference\n", + " # routing = pywrapcp.RoutingModel(tsp_size, num_routes, start)\n", + "\n", + " # New Way according to ortools v7.0 docs (https://developers.google.com/optimization/support/release_notes#announcing-the-release-of-or-tools-v70)\n", + " # manager = pywrapcp.RoutingIndexManager(num_locations, num_vehicles, depot)\n", + " # routing = pywrapcp.RoutingModel(manager)\n", + "\n", + " # Adaption according to old and new way\n", + " manager = pywrapcp.RoutingIndexManager(tsp_size, num_routes, start)\n", + " routing = pywrapcp.RoutingModel(manager)\n", + "\n", + "\n", + " # Create the distance callback, which takes two arguments (the from and to node indices)\n", + " # and returns the distance between these nodes.\n", + " def distance_callback(from_index, to_index):\n", + " \"\"\"Returns the distance between the two nodes.\"\"\"\n", + " # Convert from routing variable Index to distance matrix NodeIndex.\n", + " from_node = manager.IndexToNode(from_index)\n", + " to_node = manager.IndexToNode(to_index)\n", + " return int(pubs_matrix.durations[from_node][to_node])\n", + "\n", + "\n", + " # Since v7.0, this also needs to be wrapped:\n", + " transit_callback_index = routing.RegisterTransitCallback(distance_callback)\n", + "\n", + " routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index)\n", + " # Solve, returns a solution if any.\n", + " assignment = routing.Solve()\n", + " if assignment:\n", + " # Total cost of the 'optimal' solution.\n", + " print(\"Total duration: \" + str(round(assignment.ObjectiveValue(), 3) / 60) + \" minutes\\n\")\n", + " index = routing.Start(start) # Index of the variable for the starting node.\n", + " route = ''\n", + " # while not routing.IsEnd(index):\n", + " for node in range(routing.nodes()):\n", + " # IndexToNode has been moved from the RoutingModel to the RoutingIndexManager\n", + " optimal_coords.append(pubs_coords[manager.IndexToNode(index)])\n", + " route += str(pubs_addresses[manager.IndexToNode(index)]) + ' -> '\n", + " index = assignment.Value(routing.NextVar(index))\n", + " route += str(pubs_addresses[manager.IndexToNode(index)])\n", + " optimal_coords.append(pubs_coords[manager.IndexToNode(index)])\n", + " print(\"Route:\\n\" + route)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Visualizing both, the optimal route, and the more or less random waypoint order of the initial GeoJSON, look like this:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def style_function(color):\n", + " return lambda feature: dict(color=color,\n", + " weight=3,\n", + " opacity=1)\n", + "\n", + "\n", + "# See what a 'random' tour would have been\n", + "pubs_coords.append(pubs_coords[0])\n", + "body = ors.DirectionsServiceBody(\n", + " coordinates=pubs_coords,\n", + " geometry=True\n", + ")\n", + "profile = 'driving-car'\n", + "\n", + "directionsApi = ors.DirectionsServiceApi(ors.apiClient(api_key))\n", + "random_route = directionsApi.get_geo_json_route(body, profile)\n", + "\n", + "folium.features.GeoJson(data=ors.todict(random_route),\n", + " name='Random Bar Crawl',\n", + " style_function=style_function('#84e184'),\n", + " overlay=True).add_to(m)\n", + "\n", + "# And now the optimal route\n", + "body.coordinates = optimal_coords\n", + "optimal_route = directionsApi.get_geo_json_route(body, profile)\n", + "folium.features.GeoJson(data=ors.todict(optimal_route),\n", + " name='Optimal Bar Crawl',\n", + " style_function=style_function('#6666ff'),\n", + " overlay=True).add_to(m)\n", + "\n", + "m.add_child(folium.map.LayerControl())\n", + "m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The purple route looks a bit less painful. Let's see what the actual numbers say:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "optimal_duration = 0\n", + "random_duration = 0\n", + "\n", + "optimal_duration = optimal_route.features[0]['properties']['summary']['duration'] / 60\n", + "random_duration = random_route.features[0]['properties']['summary']['duration'] / 60\n", + "\n", + "print(\"Duration optimal route: {0:.3f} mins\\nDuration random route: {1:.3f} mins\".format(optimal_duration,\n", + " random_duration))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Optimizing that route saved us a good 120€ worth of taxi costs." + ] + } + ], + "metadata": { + "jupytext": { + "encoding": "# -*- coding: utf-8 -*-", + "formats": "ipynb,py:light" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 00000000..ae01b182 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/index.md b/index.md new file mode 100644 index 00000000..ae568562 --- /dev/null +++ b/index.md @@ -0,0 +1,27 @@ +--- +# https://vitepress.dev/reference/default-theme-home-page +layout: home + +hero: + name: "openrouteservice-py documentation" + tagline: "🐍 The Python API to consume openrouteservice(s) painlessly!" + actions: + - theme: brand + text: openrouteservice.org + link: https://openrouteservice.org + - theme: alt + text: API Playground + link: https://openrouteservice.org/dev/#/api-docs + +features: + - title: Getting started + details: Installation and usage of openrouteservice-py + link: /README + - title: Local instance + details: Use openrouteservice-py with your local instance + link: /README#local_ors_instance + - title: API Endpoints + details: Documentation for the API Endpoints that are available in openrouteservice-py + link: /README#documentation_for_api_endpoints +--- + diff --git a/openrouteservice/__init__.py b/openrouteservice/__init__.py index 16448c14..652a6a21 100644 --- a/openrouteservice/__init__.py +++ b/openrouteservice/__init__.py @@ -1,39 +1,58 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# +# coding: utf-8 -"""Initialize openrouteservice.""" -import pkg_resources +# flake8: noqa -__version__ = pkg_resources.get_distribution("openrouteservice").version +""" + Openrouteservice + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 -def get_ordinal(number): - """Produces an ordinal (1st, 2nd, 3rd, 4th) from a number.""" + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" - if number == 1: - return "st" - elif number == 2: - return "nd" - elif number == 3: - return "rd" - else: - return "th" +from __future__ import absolute_import - -from openrouteservice.client import Client # noqa +# import apis into sdk package +from openrouteservice.api.directions_service_api import DirectionsServiceApi +from openrouteservice.api.elevation_api import ElevationApi +from openrouteservice.api.geocode_api import GeocodeApi +from openrouteservice.api.isochrones_service_api import IsochronesServiceApi +from openrouteservice.api.matrix_service_api import MatrixServiceApi +from openrouteservice.api.optimization_api import OptimizationApi +from openrouteservice.api.pois_api import PoisApi +from openrouteservice.api.snapping_service_api import SnappingServiceApi +# import ApiClient +from openrouteservice.api_client import ApiClient +from openrouteservice.configuration import Configuration +# import models into sdk package +from openrouteservice.models.alternative_routes import AlternativeRoutes +from openrouteservice.models.directions_service_body import DirectionsServiceBody +from openrouteservice.models.elevation_line_body import ElevationLineBody +from openrouteservice.models.elevation_point_body import ElevationPointBody +from openrouteservice.models.isochrones_profile_body import IsochronesProfileBody +from openrouteservice.models.json_response import JSONResponse +from openrouteservice.models.matrix_profile_body import MatrixProfileBody +from openrouteservice.models.openpoiservice_poi_request import OpenpoiservicePoiRequest +from openrouteservice.models.optimization_body import OptimizationBody +from openrouteservice.models.optimization_breaks import OptimizationBreaks +from openrouteservice.models.optimization_costs import OptimizationCosts +from openrouteservice.models.optimization_jobs import OptimizationJobs +from openrouteservice.models.optimization_matrices import OptimizationMatrices +from openrouteservice.models.optimization_matrices_cyclingelectric import OptimizationMatricesCyclingelectric +from openrouteservice.models.optimization_options import OptimizationOptions +from openrouteservice.models.optimization_steps import OptimizationSteps +from openrouteservice.models.optimization_vehicles import OptimizationVehicles +from openrouteservice.models.pois_filters import PoisFilters +from openrouteservice.models.pois_geometry import PoisGeometry +from openrouteservice.models.profile_geojson_body import ProfileGeojsonBody +from openrouteservice.models.profile_json_body import ProfileJsonBody +from openrouteservice.models.profile_parameters import ProfileParameters +from openrouteservice.models.profile_parameters_restrictions import ProfileParametersRestrictions +from openrouteservice.models.profile_weightings import ProfileWeightings +from openrouteservice.models.round_trip_route_options import RoundTripRouteOptions +from openrouteservice.models.route_options import RouteOptions +from openrouteservice.models.route_options_avoid_polygons import RouteOptionsAvoidPolygons +from openrouteservice.models.snap_profile_body import SnapProfileBody +from openrouteservice.utility import * diff --git a/openrouteservice/api/__init__.py b/openrouteservice/api/__init__.py new file mode 100644 index 00000000..4f699522 --- /dev/null +++ b/openrouteservice/api/__init__.py @@ -0,0 +1,13 @@ +from __future__ import absolute_import + +# flake8: noqa + +# import apis into api package +from openrouteservice.api.directions_service_api import DirectionsServiceApi +from openrouteservice.api.elevation_api import ElevationApi +from openrouteservice.api.geocode_api import GeocodeApi +from openrouteservice.api.isochrones_service_api import IsochronesServiceApi +from openrouteservice.api.matrix_service_api import MatrixServiceApi +from openrouteservice.api.optimization_api import OptimizationApi +from openrouteservice.api.pois_api import PoisApi +from openrouteservice.api.snapping_service_api import SnappingServiceApi diff --git a/openrouteservice/api/directions_service_api.py b/openrouteservice/api/directions_service_api.py new file mode 100644 index 00000000..193cfe3d --- /dev/null +++ b/openrouteservice/api/directions_service_api.py @@ -0,0 +1,247 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from openrouteservice.api_client import ApiClient + + +class DirectionsServiceApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_geo_json_route(self, body, profile, **kwargs): # noqa: E501 + """Directions Service GeoJSON # noqa: E501 + + Returns a route between two or more locations for a selected profile and its settings as GeoJSON # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_geo_json_route(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DirectionsServiceBody body: (required) + :param str profile: Specifies the route profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_geo_json_route_with_http_info(body, profile, **kwargs) # noqa: E501 + else: + (data) = self.get_geo_json_route_with_http_info(body, profile, **kwargs) # noqa: E501 + return data + + def get_geo_json_route_with_http_info(self, body, profile, **kwargs): # noqa: E501 + """Directions Service GeoJSON # noqa: E501 + + Returns a route between two or more locations for a selected profile and its settings as GeoJSON # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_geo_json_route_with_http_info(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DirectionsServiceBody body: (required) + :param str profile: Specifies the route profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'profile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_geo_json_route" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `get_geo_json_route`") # noqa: E501 + # verify the required parameter 'profile' is set + if ('profile' not in params or + params['profile'] is None): + raise ValueError("Missing the required parameter `profile` when calling `get_geo_json_route`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'profile' in params: + path_params['profile'] = params['profile'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/geo+json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/v2/directions/{profile}/geojson', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_json_route(self, body, profile, **kwargs): # noqa: E501 + """Directions Service JSON # noqa: E501 + + Returns a route between two or more locations for a selected profile and its settings as JSON # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_json_route(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DirectionsServiceBody body: (required) + :param str profile: Specifies the route profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_json_route_with_http_info(body, profile, **kwargs) # noqa: E501 + else: + (data) = self.get_json_route_with_http_info(body, profile, **kwargs) # noqa: E501 + return data + + def get_json_route_with_http_info(self, body, profile, **kwargs): # noqa: E501 + """Directions Service JSON # noqa: E501 + + Returns a route between two or more locations for a selected profile and its settings as JSON # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_json_route_with_http_info(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DirectionsServiceBody body: (required) + :param str profile: Specifies the route profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'profile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_json_route" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `get_json_route`") # noqa: E501 + # verify the required parameter 'profile' is set + if ('profile' not in params or + params['profile'] is None): + raise ValueError("Missing the required parameter `profile` when calling `get_json_route`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'profile' in params: + path_params['profile'] = params['profile'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/v2/directions/{profile}/json', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/openrouteservice/api/elevation_api.py b/openrouteservice/api/elevation_api.py new file mode 100644 index 00000000..f7115e5a --- /dev/null +++ b/openrouteservice/api/elevation_api.py @@ -0,0 +1,335 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from openrouteservice.api_client import ApiClient + + +class ElevationApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def elevation_line_post(self, body, **kwargs): # noqa: E501 + """Elevation Line Service # noqa: E501 + + This endpoint can take planar 2D line objects and enrich them with elevation from a variety of datasets. The input and output formats are: * GeoJSON * Polyline * Google's Encoded polyline with coordinate precision 5 or 6 Example: ``` # POST LineString as polyline curl -XPOST https://api.openrouteservice.org/elevation/line -H 'Content-Type: application/json' \\ -H 'Authorization: INSERT_YOUR_KEY -d '{ \"format_in\": \"polyline\", \"format_out\": \"encodedpolyline5\", \"geometry\": [[13.349762, 38.112952], [12.638397, 37.645772]] }' ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.elevation_line_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ElevationLineBody body: Query the elevation of a line in various formats. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.elevation_line_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.elevation_line_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def elevation_line_post_with_http_info(self, body, **kwargs): # noqa: E501 + """Elevation Line Service # noqa: E501 + + This endpoint can take planar 2D line objects and enrich them with elevation from a variety of datasets. The input and output formats are: * GeoJSON * Polyline * Google's Encoded polyline with coordinate precision 5 or 6 Example: ``` # POST LineString as polyline curl -XPOST https://api.openrouteservice.org/elevation/line -H 'Content-Type: application/json' \\ -H 'Authorization: INSERT_YOUR_KEY -d '{ \"format_in\": \"polyline\", \"format_out\": \"encodedpolyline5\", \"geometry\": [[13.349762, 38.112952], [12.638397, 37.645772]] }' ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.elevation_line_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ElevationLineBody body: Query the elevation of a line in various formats. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method elevation_line_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `elevation_line_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/elevation/line', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def elevation_point_get(self, geometry, **kwargs): # noqa: E501 + """Elevation Point Service # noqa: E501 + + This endpoint can take a 2D point and enrich it with elevation from a variety of datasets. The output formats are: * GeoJSON * Point Example: ``` # GET point curl -XGET https://localhost:5000/elevation/point?geometry=13.349762,38.11295 ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.elevation_point_get(geometry, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[float] geometry: The point to be queried, in comma-separated lon,lat values, e.g. [13.349762, 38.11295] (required) + :param str format_out: The output format to be returned. + :param str dataset: The elevation dataset to be used. + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.elevation_point_get_with_http_info(geometry, **kwargs) # noqa: E501 + else: + (data) = self.elevation_point_get_with_http_info(geometry, **kwargs) # noqa: E501 + return data + + def elevation_point_get_with_http_info(self, geometry, **kwargs): # noqa: E501 + """Elevation Point Service # noqa: E501 + + This endpoint can take a 2D point and enrich it with elevation from a variety of datasets. The output formats are: * GeoJSON * Point Example: ``` # GET point curl -XGET https://localhost:5000/elevation/point?geometry=13.349762,38.11295 ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.elevation_point_get_with_http_info(geometry, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[float] geometry: The point to be queried, in comma-separated lon,lat values, e.g. [13.349762, 38.11295] (required) + :param str format_out: The output format to be returned. + :param str dataset: The elevation dataset to be used. + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['geometry', 'format_out', 'dataset'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method elevation_point_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'geometry' is set + if ('geometry' not in params or + params['geometry'] is None): + raise ValueError("Missing the required parameter `geometry` when calling `elevation_point_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'geometry' in params: + query_params.append(('geometry', params['geometry'])) # noqa: E501 + collection_formats['geometry'] = 'csv' # noqa: E501 + if 'format_out' in params: + query_params.append(('format_out', params['format_out'])) # noqa: E501 + if 'dataset' in params: + query_params.append(('dataset', params['dataset'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/elevation/point', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def elevation_point_post(self, body, **kwargs): # noqa: E501 + """Elevation Point Service # noqa: E501 + + This endpoint can take a 2D point and enrich it with elevation from a variety of datasets. The input and output formats are: * GeoJSON * Point Example: ``` # POST point as GeoJSON # https://api.openrouteservice.org/elevation/point?api_key=YOUR-KEY { \"format_in\": \"geojson\", \"format_out\": \"geojson\", \"geometry\": { \"coordinates\": [13.349762, 38.11295], \"type\": \"Point\" } } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.elevation_point_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ElevationPointBody body: Query the elevation of a point in various formats. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.elevation_point_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.elevation_point_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def elevation_point_post_with_http_info(self, body, **kwargs): # noqa: E501 + """Elevation Point Service # noqa: E501 + + This endpoint can take a 2D point and enrich it with elevation from a variety of datasets. The input and output formats are: * GeoJSON * Point Example: ``` # POST point as GeoJSON # https://api.openrouteservice.org/elevation/point?api_key=YOUR-KEY { \"format_in\": \"geojson\", \"format_out\": \"geojson\", \"geometry\": { \"coordinates\": [13.349762, 38.11295], \"type\": \"Point\" } } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.elevation_point_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ElevationPointBody body: Query the elevation of a point in various formats. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method elevation_point_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `elevation_point_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/elevation/point', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/openrouteservice/api/geocode_api.py b/openrouteservice/api/geocode_api.py new file mode 100644 index 00000000..f2a0747f --- /dev/null +++ b/openrouteservice/api/geocode_api.py @@ -0,0 +1,617 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from openrouteservice.api_client import ApiClient + + +class GeocodeApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def geocode_autocomplete_get(self, text, **kwargs): # noqa: E501 + """Geocode Autocomplete Service # noqa: E501 + + **Requests should be throttled when using this endpoint!** *Be aware that Responses are asynchronous.* Returns a JSON formatted list of objects corresponding to the search input. `boundary.*`-parameters can be combined if they are overlapping. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/autocomplete.md) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.geocode_autocomplete_get(text, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str text: Name of location, street address or postal code. (required) + :param float focus_point_lon: Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. + :param float focus_point_lat: Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. + :param float boundary_rect_min_lon: Left border of rectangular boundary to narrow results. + :param float boundary_rect_min_lat: Bottom border of rectangular boundary to narrow results. + :param float boundary_rect_max_lon: Right border of rectangular boundary to narrow results. + :param float boundary_rect_max_lat: Top border of rectangular boundary to narrow results. + :param str boundary_country: Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. + :param list[str] sources: Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). + :param list[str] layers: Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.geocode_autocomplete_get_with_http_info(text, **kwargs) # noqa: E501 + else: + (data) = self.geocode_autocomplete_get_with_http_info(text, **kwargs) # noqa: E501 + return data + + def geocode_autocomplete_get_with_http_info(self, text, **kwargs): # noqa: E501 + """Geocode Autocomplete Service # noqa: E501 + + **Requests should be throttled when using this endpoint!** *Be aware that Responses are asynchronous.* Returns a JSON formatted list of objects corresponding to the search input. `boundary.*`-parameters can be combined if they are overlapping. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/autocomplete.md) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.geocode_autocomplete_get_with_http_info(text, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str text: Name of location, street address or postal code. (required) + :param float focus_point_lon: Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. + :param float focus_point_lat: Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. + :param float boundary_rect_min_lon: Left border of rectangular boundary to narrow results. + :param float boundary_rect_min_lat: Bottom border of rectangular boundary to narrow results. + :param float boundary_rect_max_lon: Right border of rectangular boundary to narrow results. + :param float boundary_rect_max_lat: Top border of rectangular boundary to narrow results. + :param str boundary_country: Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. + :param list[str] sources: Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). + :param list[str] layers: Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['text', 'focus_point_lon', 'focus_point_lat', 'boundary_rect_min_lon', 'boundary_rect_min_lat', 'boundary_rect_max_lon', 'boundary_rect_max_lat', 'boundary_country', 'sources', 'layers'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method geocode_autocomplete_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'text' is set + if ('text' not in params or + params['text'] is None): + raise ValueError("Missing the required parameter `text` when calling `geocode_autocomplete_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'text' in params: + query_params.append(('text', params['text'])) # noqa: E501 + if 'focus_point_lon' in params: + query_params.append(('focus.point.lon', params['focus_point_lon'])) # noqa: E501 + if 'focus_point_lat' in params: + query_params.append(('focus.point.lat', params['focus_point_lat'])) # noqa: E501 + if 'boundary_rect_min_lon' in params: + query_params.append(('boundary.rect.min_lon', params['boundary_rect_min_lon'])) # noqa: E501 + if 'boundary_rect_min_lat' in params: + query_params.append(('boundary.rect.min_lat', params['boundary_rect_min_lat'])) # noqa: E501 + if 'boundary_rect_max_lon' in params: + query_params.append(('boundary.rect.max_lon', params['boundary_rect_max_lon'])) # noqa: E501 + if 'boundary_rect_max_lat' in params: + query_params.append(('boundary.rect.max_lat', params['boundary_rect_max_lat'])) # noqa: E501 + if 'boundary_country' in params: + query_params.append(('boundary.country', params['boundary_country'])) # noqa: E501 + if 'sources' in params: + query_params.append(('sources', params['sources'])) # noqa: E501 + collection_formats['sources'] = 'multi' # noqa: E501 + if 'layers' in params: + query_params.append(('layers', params['layers'])) # noqa: E501 + collection_formats['layers'] = 'multi' # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/geocode/autocomplete', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def geocode_reverse_get(self, point_lon, point_lat, **kwargs): # noqa: E501 + """Reverse Geocode Service # noqa: E501 + + Returns the next enclosing object with an address tag which surrounds the given coordinate. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/reverse.md#reverse-geocoding) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.geocode_reverse_get(point_lon, point_lat, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param float point_lon: Longitude of the coordinate to query. (required) + :param float point_lat: Latitude of the coordinate to query. (required) + :param float boundary_circle_radius: Restrict search to circular region around `point.lat/point.lon`. Value in kilometers. + :param int size: Set the number of returned results. + :param list[str] layers: Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `locality`|towns, hamlets, cities| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| + :param list[str] sources: Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). + :param str boundary_country: Restrict search to country by [alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [alpha 3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) codes. + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.geocode_reverse_get_with_http_info(point_lon, point_lat, **kwargs) # noqa: E501 + else: + (data) = self.geocode_reverse_get_with_http_info(point_lon, point_lat, **kwargs) # noqa: E501 + return data + + def geocode_reverse_get_with_http_info(self, point_lon, point_lat, **kwargs): # noqa: E501 + """Reverse Geocode Service # noqa: E501 + + Returns the next enclosing object with an address tag which surrounds the given coordinate. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/reverse.md#reverse-geocoding) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.geocode_reverse_get_with_http_info(point_lon, point_lat, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param float point_lon: Longitude of the coordinate to query. (required) + :param float point_lat: Latitude of the coordinate to query. (required) + :param float boundary_circle_radius: Restrict search to circular region around `point.lat/point.lon`. Value in kilometers. + :param int size: Set the number of returned results. + :param list[str] layers: Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `locality`|towns, hamlets, cities| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| + :param list[str] sources: Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). + :param str boundary_country: Restrict search to country by [alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [alpha 3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) codes. + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['point_lon', 'point_lat', 'boundary_circle_radius', 'size', 'layers', 'sources', 'boundary_country'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method geocode_reverse_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'point_lon' is set + if ('point_lon' not in params or + params['point_lon'] is None): + raise ValueError("Missing the required parameter `point_lon` when calling `geocode_reverse_get`") # noqa: E501 + # verify the required parameter 'point_lat' is set + if ('point_lat' not in params or + params['point_lat'] is None): + raise ValueError("Missing the required parameter `point_lat` when calling `geocode_reverse_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'point_lon' in params: + query_params.append(('point.lon', params['point_lon'])) # noqa: E501 + if 'point_lat' in params: + query_params.append(('point.lat', params['point_lat'])) # noqa: E501 + if 'boundary_circle_radius' in params: + query_params.append(('boundary.circle.radius', params['boundary_circle_radius'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'layers' in params: + query_params.append(('layers', params['layers'])) # noqa: E501 + collection_formats['layers'] = 'multi' # noqa: E501 + if 'sources' in params: + query_params.append(('sources', params['sources'])) # noqa: E501 + collection_formats['sources'] = 'multi' # noqa: E501 + if 'boundary_country' in params: + query_params.append(('boundary.country', params['boundary_country'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/geocode/reverse', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def geocode_search_get(self, text, **kwargs): # noqa: E501 + """Forward Geocode Service # noqa: E501 + + Returns a JSON formatted list of objects corresponding to the search input. `boundary.*`-parameters can be combined if they are overlapping. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/search.md#search-the-world) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.geocode_search_get(text, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str text: Name of location, street address or postal code. (required) + :param float focus_point_lon: Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. + :param float focus_point_lat: Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. + :param float boundary_rect_min_lon: Left border of rectangular boundary to narrow results. + :param float boundary_rect_min_lat: Bottom border of rectangular boundary to narrow results. + :param float boundary_rect_max_lon: Right border of rectangular boundary to narrow results. + :param float boundary_rect_max_lat: Top border of rectangular boundary to narrow results. + :param float boundary_circle_lon: Center Longitude of circular boundary to narrow results. Use with `boundary.circle.lat` & `boundary.circle.radius`. + :param float boundary_circle_lat: Center Latitude of circular boundary to narrow results. Use with `boundary.circle.lon` & `boundary.circle.radius`. + :param float boundary_circle_radius: Radius of circular boundary around the center coordinate in kilometers. Use with `boundary.circle.lon` & `boundary.circle.lat`. + :param str boundary_gid: Restrict results to administrative boundary using a Pelias global id [`gid`](https://github.com/pelias/documentation/blob/f1f475aa4f8c18426fb80baea636990502c08ed3/search.md#search-within-a-parent-administrative-area). `gid`s for records can be found using either the [Who's on First Spelunker](http://spelunker.whosonfirst.org/), a tool for searching Who's on First data, or from the responses of other Pelias queries. In this case a [search for Oklahoma](http://pelias.github.io/compare/#/v1/search%3Ftext=oklahoma) will return the proper `gid`. + :param str boundary_country: Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. + :param list[str] sources: Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). + :param list[str] layers: Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| + :param int size: Set the number of returned results. + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.geocode_search_get_with_http_info(text, **kwargs) # noqa: E501 + else: + (data) = self.geocode_search_get_with_http_info(text, **kwargs) # noqa: E501 + return data + + def geocode_search_get_with_http_info(self, text, **kwargs): # noqa: E501 + """Forward Geocode Service # noqa: E501 + + Returns a JSON formatted list of objects corresponding to the search input. `boundary.*`-parameters can be combined if they are overlapping. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/search.md#search-the-world) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.geocode_search_get_with_http_info(text, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str text: Name of location, street address or postal code. (required) + :param float focus_point_lon: Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. + :param float focus_point_lat: Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. + :param float boundary_rect_min_lon: Left border of rectangular boundary to narrow results. + :param float boundary_rect_min_lat: Bottom border of rectangular boundary to narrow results. + :param float boundary_rect_max_lon: Right border of rectangular boundary to narrow results. + :param float boundary_rect_max_lat: Top border of rectangular boundary to narrow results. + :param float boundary_circle_lon: Center Longitude of circular boundary to narrow results. Use with `boundary.circle.lat` & `boundary.circle.radius`. + :param float boundary_circle_lat: Center Latitude of circular boundary to narrow results. Use with `boundary.circle.lon` & `boundary.circle.radius`. + :param float boundary_circle_radius: Radius of circular boundary around the center coordinate in kilometers. Use with `boundary.circle.lon` & `boundary.circle.lat`. + :param str boundary_gid: Restrict results to administrative boundary using a Pelias global id [`gid`](https://github.com/pelias/documentation/blob/f1f475aa4f8c18426fb80baea636990502c08ed3/search.md#search-within-a-parent-administrative-area). `gid`s for records can be found using either the [Who's on First Spelunker](http://spelunker.whosonfirst.org/), a tool for searching Who's on First data, or from the responses of other Pelias queries. In this case a [search for Oklahoma](http://pelias.github.io/compare/#/v1/search%3Ftext=oklahoma) will return the proper `gid`. + :param str boundary_country: Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. + :param list[str] sources: Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). + :param list[str] layers: Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| + :param int size: Set the number of returned results. + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['text', 'focus_point_lon', 'focus_point_lat', 'boundary_rect_min_lon', 'boundary_rect_min_lat', 'boundary_rect_max_lon', 'boundary_rect_max_lat', 'boundary_circle_lon', 'boundary_circle_lat', 'boundary_circle_radius', 'boundary_gid', 'boundary_country', 'sources', 'layers', 'size'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method geocode_search_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'text' is set + if ('text' not in params or + params['text'] is None): + raise ValueError("Missing the required parameter `text` when calling `geocode_search_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'text' in params: + query_params.append(('text', params['text'])) # noqa: E501 + if 'focus_point_lon' in params: + query_params.append(('focus.point.lon', params['focus_point_lon'])) # noqa: E501 + if 'focus_point_lat' in params: + query_params.append(('focus.point.lat', params['focus_point_lat'])) # noqa: E501 + if 'boundary_rect_min_lon' in params: + query_params.append(('boundary.rect.min_lon', params['boundary_rect_min_lon'])) # noqa: E501 + if 'boundary_rect_min_lat' in params: + query_params.append(('boundary.rect.min_lat', params['boundary_rect_min_lat'])) # noqa: E501 + if 'boundary_rect_max_lon' in params: + query_params.append(('boundary.rect.max_lon', params['boundary_rect_max_lon'])) # noqa: E501 + if 'boundary_rect_max_lat' in params: + query_params.append(('boundary.rect.max_lat', params['boundary_rect_max_lat'])) # noqa: E501 + if 'boundary_circle_lon' in params: + query_params.append(('boundary.circle.lon', params['boundary_circle_lon'])) # noqa: E501 + if 'boundary_circle_lat' in params: + query_params.append(('boundary.circle.lat', params['boundary_circle_lat'])) # noqa: E501 + if 'boundary_circle_radius' in params: + query_params.append(('boundary.circle.radius', params['boundary_circle_radius'])) # noqa: E501 + if 'boundary_gid' in params: + query_params.append(('boundary.gid', params['boundary_gid'])) # noqa: E501 + if 'boundary_country' in params: + query_params.append(('boundary.country', params['boundary_country'])) # noqa: E501 + if 'sources' in params: + query_params.append(('sources', params['sources'])) # noqa: E501 + collection_formats['sources'] = 'multi' # noqa: E501 + if 'layers' in params: + query_params.append(('layers', params['layers'])) # noqa: E501 + collection_formats['layers'] = 'multi' # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/geocode/search', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def geocode_search_structured_get(self, **kwargs): # noqa: E501 + """Structured Forward Geocode Service (beta) # noqa: E501 + + Returns a JSON formatted list of objects corresponding to the search input. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/structured-geocoding.md#structured-geocoding) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.geocode_search_structured_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str address: Search for full address with house number or only a street name. + :param str neighbourhood: Search for neighbourhoods. Neighbourhoods are vernacular geographic entities that may not necessarily be official administrative divisions but are important nonetheless. Example: `Notting Hill`. + :param str country: Search for full country name, [alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [alpha 3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) codes. + :param str postalcode: Search for postal codes. Postal codes are unique within a country so they are useful in geocoding as a shorthand for a fairly granular geographical location. + :param str region: Search for regions. Regions are normally the first-level administrative divisions within countries. For US-regions [common abbreviations](https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations) can be used. + :param str county: Search for counties. Counties are administrative divisions between localities and regions. Can be useful when attempting to disambiguate between localities. + :param str locality: Search for localities. Localities are equivalent to what are commonly referred to as *cities*. + :param str borough: Search for boroughs. Boroughs are mostly known in the context of New York City, even though they may exist in other cities, such as Mexico City. Example: `Manhatten`. + :param float focus_point_lon: Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. + :param float focus_point_lat: Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. + :param float boundary_rect_min_lon: Left border of rectangular boundary to narrow results. + :param float boundary_rect_min_lat: Bottom border of rectangular boundary to narrow results. + :param float boundary_rect_max_lon: Right border of rectangular boundary to narrow results. + :param float boundary_rect_max_lat: Top border of rectangular boundary to narrow results. + :param float boundary_circle_lon: Center Longitude of circular boundary to narrow results. Use with `boundary.circle.lat` & `boundary.circle.radius`. + :param float boundary_circle_lat: Center Latitude of circular boundary to narrow results. Use with `boundary.circle.lon` & `boundary.circle.radius`. + :param float boundary_circle_radius: Radius of circular boundary around the center coordinate in kilometers. Use with `boundary.circle.lon` & `boundary.circle.lat`. + :param str boundary_country: Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. + :param list[str] layers: Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| + :param list[str] sources: Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). + :param int size: Set the number of returned results. + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.geocode_search_structured_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.geocode_search_structured_get_with_http_info(**kwargs) # noqa: E501 + return data + + def geocode_search_structured_get_with_http_info(self, **kwargs): # noqa: E501 + """Structured Forward Geocode Service (beta) # noqa: E501 + + Returns a JSON formatted list of objects corresponding to the search input. **The interactivity for this enpoint is experimental!** [Please refer to this external Documentation](https://github.com/pelias/documentation/blob/master/structured-geocoding.md#structured-geocoding) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.geocode_search_structured_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str address: Search for full address with house number or only a street name. + :param str neighbourhood: Search for neighbourhoods. Neighbourhoods are vernacular geographic entities that may not necessarily be official administrative divisions but are important nonetheless. Example: `Notting Hill`. + :param str country: Search for full country name, [alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [alpha 3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) codes. + :param str postalcode: Search for postal codes. Postal codes are unique within a country so they are useful in geocoding as a shorthand for a fairly granular geographical location. + :param str region: Search for regions. Regions are normally the first-level administrative divisions within countries. For US-regions [common abbreviations](https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations) can be used. + :param str county: Search for counties. Counties are administrative divisions between localities and regions. Can be useful when attempting to disambiguate between localities. + :param str locality: Search for localities. Localities are equivalent to what are commonly referred to as *cities*. + :param str borough: Search for boroughs. Boroughs are mostly known in the context of New York City, even though they may exist in other cities, such as Mexico City. Example: `Manhatten`. + :param float focus_point_lon: Longitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lat`. + :param float focus_point_lat: Latitude of the `focus.point`. Specify the focus point to order results by linear distance to this point. Works for up to 100 kilometers distance. Use with `focus.point.lon`. + :param float boundary_rect_min_lon: Left border of rectangular boundary to narrow results. + :param float boundary_rect_min_lat: Bottom border of rectangular boundary to narrow results. + :param float boundary_rect_max_lon: Right border of rectangular boundary to narrow results. + :param float boundary_rect_max_lat: Top border of rectangular boundary to narrow results. + :param float boundary_circle_lon: Center Longitude of circular boundary to narrow results. Use with `boundary.circle.lat` & `boundary.circle.radius`. + :param float boundary_circle_lat: Center Latitude of circular boundary to narrow results. Use with `boundary.circle.lon` & `boundary.circle.radius`. + :param float boundary_circle_radius: Radius of circular boundary around the center coordinate in kilometers. Use with `boundary.circle.lon` & `boundary.circle.lat`. + :param str boundary_country: Restrict results to single country. Possible values are [alpha-2 and alpha-3 country codes](https://en.wikipedia.org/wiki/ISO_3166-1). Example: `DEU` or `DE` for Germany. + :param list[str] layers: Restrict search to layers (place type). By default all layers are searched. layer|description| ----|----| `venue`|points of interest, businesses, things with walls| `address`|places with a street address| `street`|streets,roads,highways| `neighbourhood`|social communities, neighbourhoods| `borough`|a local administrative boundary, currently only used for New York City| `localadmin`|local administrative boundaries| `locality`|towns, hamlets, cities| `county`|official governmental area; usually bigger than a locality, almost always smaller than a region| `macrocounty`|a related group of counties. Mostly in Europe.| `region`|states and provinces| `macroregion`|a related group of regions. Mostly in Europe| `country`|places that issue passports, nations, nation-states| `coarse`|alias for simultaneously using all administrative layers (everything except `venue` and `address`)| + :param list[str] sources: Restrict your search to specific sources. Searches all sources by default. You can either use the normal or short name. Sources are [`openstreetmap(osm)`](http://www.openstreetmap.org/), [`openaddresses(oa)`](http://openaddresses.io/), [`whosonfirst(wof)`](https://whosonfirst.org/), [`geonames(gn)`](http://www.geonames.org/). + :param int size: Set the number of returned results. + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['address', 'neighbourhood', 'country', 'postalcode', 'region', 'county', 'locality', 'borough', 'focus_point_lon', 'focus_point_lat', 'boundary_rect_min_lon', 'boundary_rect_min_lat', 'boundary_rect_max_lon', 'boundary_rect_max_lat', 'boundary_circle_lon', 'boundary_circle_lat', 'boundary_circle_radius', 'boundary_country', 'layers', 'sources', 'size'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method geocode_search_structured_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'address' in params: + query_params.append(('address', params['address'])) # noqa: E501 + if 'neighbourhood' in params: + query_params.append(('neighbourhood', params['neighbourhood'])) # noqa: E501 + if 'country' in params: + query_params.append(('country', params['country'])) # noqa: E501 + if 'postalcode' in params: + query_params.append(('postalcode', params['postalcode'])) # noqa: E501 + if 'region' in params: + query_params.append(('region', params['region'])) # noqa: E501 + if 'county' in params: + query_params.append(('county', params['county'])) # noqa: E501 + if 'locality' in params: + query_params.append(('locality', params['locality'])) # noqa: E501 + if 'borough' in params: + query_params.append(('borough', params['borough'])) # noqa: E501 + if 'focus_point_lon' in params: + query_params.append(('focus.point.lon', params['focus_point_lon'])) # noqa: E501 + if 'focus_point_lat' in params: + query_params.append(('focus.point.lat', params['focus_point_lat'])) # noqa: E501 + if 'boundary_rect_min_lon' in params: + query_params.append(('boundary.rect.min_lon', params['boundary_rect_min_lon'])) # noqa: E501 + if 'boundary_rect_min_lat' in params: + query_params.append(('boundary.rect.min_lat', params['boundary_rect_min_lat'])) # noqa: E501 + if 'boundary_rect_max_lon' in params: + query_params.append(('boundary.rect.max_lon', params['boundary_rect_max_lon'])) # noqa: E501 + if 'boundary_rect_max_lat' in params: + query_params.append(('boundary.rect.max_lat', params['boundary_rect_max_lat'])) # noqa: E501 + if 'boundary_circle_lon' in params: + query_params.append(('boundary.circle.lon', params['boundary_circle_lon'])) # noqa: E501 + if 'boundary_circle_lat' in params: + query_params.append(('boundary.circle.lat', params['boundary_circle_lat'])) # noqa: E501 + if 'boundary_circle_radius' in params: + query_params.append(('boundary.circle.radius', params['boundary_circle_radius'])) # noqa: E501 + if 'boundary_country' in params: + query_params.append(('boundary.country', params['boundary_country'])) # noqa: E501 + if 'layers' in params: + query_params.append(('layers', params['layers'])) # noqa: E501 + collection_formats['layers'] = 'multi' # noqa: E501 + if 'sources' in params: + query_params.append(('sources', params['sources'])) # noqa: E501 + collection_formats['sources'] = 'multi' # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/geocode/search/structured', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/openrouteservice/api/isochrones_service_api.py b/openrouteservice/api/isochrones_service_api.py new file mode 100644 index 00000000..7038e4d7 --- /dev/null +++ b/openrouteservice/api/isochrones_service_api.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from openrouteservice.api_client import ApiClient + + +class IsochronesServiceApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_default_isochrones(self, body, profile, **kwargs): # noqa: E501 + """Isochrones Service # noqa: E501 + + The Isochrone Service supports time and distance analyses for one single or multiple locations. You may also specify the isochrone interval or provide multiple exact isochrone range values. This service allows the same range of profile options as the /directions endpoint, which help you to further customize your request to obtain a more detailed reachability area response. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_isochrones(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param IsochronesProfileBody body: (required) + :param str profile: Specifies the route profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_isochrones_with_http_info(body, profile, **kwargs) # noqa: E501 + else: + (data) = self.get_default_isochrones_with_http_info(body, profile, **kwargs) # noqa: E501 + return data + + def get_default_isochrones_with_http_info(self, body, profile, **kwargs): # noqa: E501 + """Isochrones Service # noqa: E501 + + The Isochrone Service supports time and distance analyses for one single or multiple locations. You may also specify the isochrone interval or provide multiple exact isochrone range values. This service allows the same range of profile options as the /directions endpoint, which help you to further customize your request to obtain a more detailed reachability area response. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_isochrones_with_http_info(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param IsochronesProfileBody body: (required) + :param str profile: Specifies the route profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'profile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_isochrones" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `get_default_isochrones`") # noqa: E501 + # verify the required parameter 'profile' is set + if ('profile' not in params or + params['profile'] is None): + raise ValueError("Missing the required parameter `profile` when calling `get_default_isochrones`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'profile' in params: + path_params['profile'] = params['profile'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/geo+json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/v2/isochrones/{profile}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/openrouteservice/api/matrix_service_api.py b/openrouteservice/api/matrix_service_api.py new file mode 100644 index 00000000..1d183886 --- /dev/null +++ b/openrouteservice/api/matrix_service_api.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from openrouteservice.api_client import ApiClient + + +class MatrixServiceApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_default1(self, body, profile, **kwargs): # noqa: E501 + """Matrix Service # noqa: E501 + + Returns duration or distance matrix for multiple source and destination points. By default a square duration matrix is returned where every point in locations is paired with each other. The result is null if a value can’t be determined. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default1(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param MatrixProfileBody body: (required) + :param str profile: Specifies the matrix profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default1_with_http_info(body, profile, **kwargs) # noqa: E501 + else: + (data) = self.get_default1_with_http_info(body, profile, **kwargs) # noqa: E501 + return data + + def get_default1_with_http_info(self, body, profile, **kwargs): # noqa: E501 + """Matrix Service # noqa: E501 + + Returns duration or distance matrix for multiple source and destination points. By default a square duration matrix is returned where every point in locations is paired with each other. The result is null if a value can’t be determined. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default1_with_http_info(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param MatrixProfileBody body: (required) + :param str profile: Specifies the matrix profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'profile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `get_default1`") # noqa: E501 + # verify the required parameter 'profile' is set + if ('profile' not in params or + params['profile'] is None): + raise ValueError("Missing the required parameter `profile` when calling `get_default1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'profile' in params: + path_params['profile'] = params['profile'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json;charset=UTF-8', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/v2/matrix/{profile}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/openrouteservice/api/optimization_api.py b/openrouteservice/api/optimization_api.py new file mode 100644 index 00000000..f4fb6826 --- /dev/null +++ b/openrouteservice/api/optimization_api.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from openrouteservice.api_client import ApiClient + + +class OptimizationApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def optimization_post(self, body, **kwargs): # noqa: E501 + """Optimization Service # noqa: E501 + + The optimization endpoint solves [Vehicle Routing Problems](https://en.wikipedia.org/wiki/Vehicle_routing_problem) and can be used to schedule multiple vehicles and jobs, respecting time windows, capacities and required skills. This service is based on the excellent [Vroom project](https://github.com/VROOM-Project/vroom). Please also consult its [API documentation](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md). General Info: - The expected order for all coordinates arrays is `[lon, lat]` - All timings are in seconds - All distances are in meters - A `time_window` object is a pair of timestamps in the form `[start, end]` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.optimization_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OptimizationBody body: The request body of the optimization request. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.optimization_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.optimization_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def optimization_post_with_http_info(self, body, **kwargs): # noqa: E501 + """Optimization Service # noqa: E501 + + The optimization endpoint solves [Vehicle Routing Problems](https://en.wikipedia.org/wiki/Vehicle_routing_problem) and can be used to schedule multiple vehicles and jobs, respecting time windows, capacities and required skills. This service is based on the excellent [Vroom project](https://github.com/VROOM-Project/vroom). Please also consult its [API documentation](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md). General Info: - The expected order for all coordinates arrays is `[lon, lat]` - All timings are in seconds - All distances are in meters - A `time_window` object is a pair of timestamps in the form `[start, end]` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.optimization_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OptimizationBody body: The request body of the optimization request. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method optimization_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `optimization_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/optimization', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/openrouteservice/api/pois_api.py b/openrouteservice/api/pois_api.py new file mode 100644 index 00000000..78c531e9 --- /dev/null +++ b/openrouteservice/api/pois_api.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from openrouteservice.api_client import ApiClient + + +class PoisApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def pois_post(self, body, **kwargs): # noqa: E501 + """Pois Service # noqa: E501 + + Returns points of interest in the area surrounding a geometry which can either be a bounding box, polygon or buffered linestring or point. Find more examples on [github](https://github.com/GIScience/openpoiservice). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.pois_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OpenpoiservicePoiRequest body: body for a post request (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.pois_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.pois_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def pois_post_with_http_info(self, body, **kwargs): # noqa: E501 + """Pois Service # noqa: E501 + + Returns points of interest in the area surrounding a geometry which can either be a bounding box, polygon or buffered linestring or point. Find more examples on [github](https://github.com/GIScience/openpoiservice). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.pois_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OpenpoiservicePoiRequest body: body for a post request (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method pois_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `pois_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/pois', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/openrouteservice/api/snapping_service_api.py b/openrouteservice/api/snapping_service_api.py new file mode 100644 index 00000000..17c3754f --- /dev/null +++ b/openrouteservice/api/snapping_service_api.py @@ -0,0 +1,354 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from openrouteservice.api_client import ApiClient + + +class SnappingServiceApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_default(self, body, profile, **kwargs): # noqa: E501 + """Snapping Service # noqa: E501 + + Returns a list of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, \"null\" is returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SnapProfileBody body: (required) + :param str profile: Specifies the route profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_with_http_info(body, profile, **kwargs) # noqa: E501 + else: + (data) = self.get_default_with_http_info(body, profile, **kwargs) # noqa: E501 + return data + + def get_default_with_http_info(self, body, profile, **kwargs): # noqa: E501 + """Snapping Service # noqa: E501 + + Returns a list of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, \"null\" is returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_with_http_info(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SnapProfileBody body: (required) + :param str profile: Specifies the route profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'profile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `get_default`") # noqa: E501 + # verify the required parameter 'profile' is set + if ('profile' not in params or + params['profile'] is None): + raise ValueError("Missing the required parameter `profile` when calling `get_default`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'profile' in params: + path_params['profile'] = params['profile'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/v2/snap/{profile}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_geo_json_snapping(self, body, profile, **kwargs): # noqa: E501 + """Snapping Service GeoJSON # noqa: E501 + + Returns a GeoJSON FeatureCollection of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, it is omitted from the features array. The features provide the 'source_id' property, to match the results with the input location array (IDs start at 0). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_geo_json_snapping(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ProfileGeojsonBody body: (required) + :param str profile: Specifies the profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_geo_json_snapping_with_http_info(body, profile, **kwargs) # noqa: E501 + else: + (data) = self.get_geo_json_snapping_with_http_info(body, profile, **kwargs) # noqa: E501 + return data + + def get_geo_json_snapping_with_http_info(self, body, profile, **kwargs): # noqa: E501 + """Snapping Service GeoJSON # noqa: E501 + + Returns a GeoJSON FeatureCollection of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, it is omitted from the features array. The features provide the 'source_id' property, to match the results with the input location array (IDs start at 0). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_geo_json_snapping_with_http_info(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ProfileGeojsonBody body: (required) + :param str profile: Specifies the profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'profile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_geo_json_snapping" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `get_geo_json_snapping`") # noqa: E501 + # verify the required parameter 'profile' is set + if ('profile' not in params or + params['profile'] is None): + raise ValueError("Missing the required parameter `profile` when calling `get_geo_json_snapping`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'profile' in params: + path_params['profile'] = params['profile'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/v2/snap/{profile}/geojson', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_json_snapping(self, body, profile, **kwargs): # noqa: E501 + """Snapping Service JSON # noqa: E501 + + Returns a list of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, \"null\" is returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_json_snapping(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ProfileJsonBody body: (required) + :param str profile: Specifies the profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_json_snapping_with_http_info(body, profile, **kwargs) # noqa: E501 + else: + (data) = self.get_json_snapping_with_http_info(body, profile, **kwargs) # noqa: E501 + return data + + def get_json_snapping_with_http_info(self, body, profile, **kwargs): # noqa: E501 + """Snapping Service JSON # noqa: E501 + + Returns a list of points snapped to the nearest edge in the routing graph. In case an appropriate snapping point cannot be found within the specified search radius, \"null\" is returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_json_snapping_with_http_info(body, profile, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ProfileJsonBody body: (required) + :param str profile: Specifies the profile. (required) + :return: JSONResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'profile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_json_snapping" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `get_json_snapping`") # noqa: E501 + # verify the required parameter 'profile' is set + if ('profile' not in params or + params['profile'] is None): + raise ValueError("Missing the required parameter `profile` when calling `get_json_snapping`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'profile' in params: + path_params['profile'] = params['profile'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['ApiKeyAuth'] # noqa: E501 + + return self.api_client.call_api( + '/v2/snap/{profile}/json', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JSONResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/openrouteservice/api_client.py b/openrouteservice/api_client.py new file mode 100644 index 00000000..af7c1555 --- /dev/null +++ b/openrouteservice/api_client.py @@ -0,0 +1,632 @@ +# coding: utf-8 +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" +from __future__ import absolute_import + +import datetime +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from openrouteservice.configuration import Configuration +import openrouteservice.models +from openrouteservice import rest + + +class ApiClient(object): + """Generic API client for Swagger client library builds. + + Swagger generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the Swagger + templates. + + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + self.pool = ThreadPool() + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'Swagger-Codegen/8.2.0/python' + + def __del__(self): + self.pool.close() + self.pool.join() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + url = self.configuration.host + resource_path + + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(openrouteservice.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + if not async_req: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout) + else: + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, _request_timeout)) + return thread + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "POST": + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """Builds form parameters. + + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in six.iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting['value']: + continue + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + response_data = response.data + with open(path, "wb") as f: + if isinstance(response_data, str): + # change str to bytes so we can write it + response_data = response_data.encode('utf-8') + f.write(response_data) + else: + f.write(response_data) + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __hasattr(self, object, name): + return name in object.__class__.__dict__ + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if not klass.swagger_types and not self.__hasattr(klass, 'get_real_child_model'): + return data + + kwargs = {} + if klass.swagger_types is not None: + for attr, attr_type in six.iteritems(klass.swagger_types): + if (data is not None and + klass.attribute_map[attr] in data and + isinstance(data, (list, dict))): + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if (isinstance(instance, dict) and + klass.swagger_types is not None and + isinstance(data, dict)): + for key, value in data.items(): + if key not in klass.swagger_types: + instance[key] = value + if self.__hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/openrouteservice/configuration.py b/openrouteservice/configuration.py new file mode 100644 index 00000000..0faefdc8 --- /dev/null +++ b/openrouteservice/configuration.py @@ -0,0 +1,251 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import six +from six.moves import http_client as httplib + + +class TypeWithDefault(type): + def __init__(cls, name, bases, dct): + super(TypeWithDefault, cls).__init__(name, bases, dct) + cls._default = None + + def __call__(cls): + if cls._default is None: + cls._default = type.__call__(cls) + return copy.copy(cls._default) + + def set_default(cls, default): + cls._default = copy.copy(default) + + +class Configuration(six.with_metaclass(TypeWithDefault, object)): + """NOTE: This class is auto generated by the swagger code generator program. + + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + """ + + def __init__(self): + """Constructor""" + # Default Base url + self.host = "https://api.openrouteservice.org" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # function to refresh API key if expired + self.refresh_api_key_hook = None + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("openrouteservice") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API + # from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = '' + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook: + self.refresh_api_key_hook(self) + + key = self.api_key.get(identifier) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return { + 'ApiKeyAuth': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_api_key_with_prefix('Authorization') + }, + } + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 8.2.0\n"\ + "SDK Package Version: 8.2.0".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/openrouteservice/legacy/__init__.py b/openrouteservice/legacy/__init__.py new file mode 100644 index 00000000..0541711a --- /dev/null +++ b/openrouteservice/legacy/__init__.py @@ -0,0 +1,13 @@ +__version__ = "2.3.3" + +def get_ordinal(number): + """Produces an ordinal (1st, 2nd, 3rd, 4th) from a number.""" + + if number == 1: + return "st" + elif number == 2: + return "nd" + elif number == 3: + return "rd" + else: + return "th" \ No newline at end of file diff --git a/openrouteservice/client.py b/openrouteservice/legacy/client.py similarity index 92% rename from openrouteservice/client.py rename to openrouteservice/legacy/client.py index afaf7d34..d90baab6 100644 --- a/openrouteservice/client.py +++ b/openrouteservice/legacy/client.py @@ -29,7 +29,7 @@ import time import warnings -from openrouteservice import exceptions, __version__, get_ordinal +from openrouteservice.legacy import exceptions, __version__, get_ordinal, deprecation _USER_AGENT = "ORSClientPython.v{}".format(__version__) _DEFAULT_BASE_URL = "https://api.openrouteservice.org" @@ -78,6 +78,8 @@ def __init__( :type retry_over_query_limit: bool """ + deprecation.deprecated("Client", "ApiClient") + self._session = requests.Session() self._key = key self._base_url = base_url @@ -297,17 +299,17 @@ def _generate_auth_url(path, params): return path + "?" + _urlencode_params(params) -from openrouteservice.directions import directions # noqa -from openrouteservice.distance_matrix import distance_matrix # noqa -from openrouteservice.elevation import elevation_point # noqa -from openrouteservice.elevation import elevation_line # noqa -from openrouteservice.isochrones import isochrones # noqa -from openrouteservice.geocode import pelias_search # noqa -from openrouteservice.geocode import pelias_autocomplete # noqa -from openrouteservice.geocode import pelias_structured # noqa -from openrouteservice.geocode import pelias_reverse # noqa -from openrouteservice.places import places # noqa -from openrouteservice.optimization import optimization # noqa +from openrouteservice.legacy.directions import directions # noqa +from openrouteservice.legacy.distance_matrix import distance_matrix # noqa +from openrouteservice.legacy.elevation import elevation_point # noqa +from openrouteservice.legacy.elevation import elevation_line # noqa +from openrouteservice.legacy.isochrones import isochrones # noqa +from openrouteservice.legacy.geocode import pelias_search # noqa +from openrouteservice.legacy.geocode import pelias_autocomplete # noqa +from openrouteservice.legacy.geocode import pelias_structured # noqa +from openrouteservice.legacy.geocode import pelias_reverse # noqa +from openrouteservice.legacy.places import places # noqa +from openrouteservice.legacy.optimization import optimization # noqa def _make_api_method(func): diff --git a/openrouteservice/convert.py b/openrouteservice/legacy/convert.py similarity index 100% rename from openrouteservice/convert.py rename to openrouteservice/legacy/convert.py diff --git a/openrouteservice/deprecation.py b/openrouteservice/legacy/deprecation.py similarity index 73% rename from openrouteservice/deprecation.py rename to openrouteservice/legacy/deprecation.py index 78871ef5..a4f2eb3d 100644 --- a/openrouteservice/deprecation.py +++ b/openrouteservice/legacy/deprecation.py @@ -30,3 +30,14 @@ def warning(old_name, new_name): DeprecationWarning, stacklevel=2, ) + +def deprecated(old_name, new_name): + """Deprecation warning.""" + + warnings.warn( + "{} is deprecated. Please use {} instead. For more information on the new SDK please check out https://github.com/GIScience/openrouteservice-py".format( + old_name, new_name + ), + DeprecationWarning, + stacklevel=2, + ) \ No newline at end of file diff --git a/openrouteservice/directions.py b/openrouteservice/legacy/directions.py similarity index 98% rename from openrouteservice/directions.py rename to openrouteservice/legacy/directions.py index c4b0b799..fa04c3f1 100644 --- a/openrouteservice/directions.py +++ b/openrouteservice/legacy/directions.py @@ -18,8 +18,8 @@ # """Performs requests to the ORS directions API.""" -from openrouteservice import deprecation -from openrouteservice.optimization import optimization, Job, Vehicle +from openrouteservice.legacy import deprecation +from openrouteservice.legacy.optimization import optimization, Job, Vehicle import warnings @@ -201,6 +201,8 @@ def directions( :rtype: call to Client.request() """ + deprecation.deprecated("Client.directions", "DirectionsServiceApi.get_geo_json_route") + # call optimization endpoint and get new order of waypoints if optimize_waypoints is not None and not dry_run: if len(coordinates) <= 3: diff --git a/openrouteservice/distance_matrix.py b/openrouteservice/legacy/distance_matrix.py similarity index 96% rename from openrouteservice/distance_matrix.py rename to openrouteservice/legacy/distance_matrix.py index 9bccca8d..ee69e018 100644 --- a/openrouteservice/distance_matrix.py +++ b/openrouteservice/legacy/distance_matrix.py @@ -19,6 +19,9 @@ """Performs requests to the ORS Matrix API.""" +from openrouteservice.legacy import deprecation + + def distance_matrix( client, locations, @@ -84,6 +87,8 @@ def distance_matrix( :rtype: call to Client.request() """ + deprecation.deprecated("Client.distance_matrix", "MatrixServiceApi.get_default") + params = { "locations": locations, } diff --git a/openrouteservice/elevation.py b/openrouteservice/legacy/elevation.py similarity index 92% rename from openrouteservice/elevation.py rename to openrouteservice/legacy/elevation.py index d44549da..8a63f7de 100644 --- a/openrouteservice/elevation.py +++ b/openrouteservice/legacy/elevation.py @@ -16,6 +16,9 @@ """Performs requests to the ORS elevation API.""" +from openrouteservice.legacy import deprecation + + def elevation_point( client, format_in, @@ -48,6 +51,8 @@ def elevation_point( :rtype: Client.request() """ + deprecation.deprecated("Client.elevation_point", "ElevationApi.elevation_point_post") + params = { "format_in": format_in, "geometry": geometry, @@ -94,6 +99,8 @@ def elevation_line( :rtype: Client.request() """ + deprecation.deprecated("Client.elevation_line", "ElevationApi.elevation_line_post") + params = { "format_in": format_in, "geometry": geometry, diff --git a/openrouteservice/exceptions.py b/openrouteservice/legacy/exceptions.py similarity index 100% rename from openrouteservice/exceptions.py rename to openrouteservice/legacy/exceptions.py diff --git a/openrouteservice/geocode.py b/openrouteservice/legacy/geocode.py similarity index 96% rename from openrouteservice/geocode.py rename to openrouteservice/legacy/geocode.py index c61ec588..0d60005e 100644 --- a/openrouteservice/geocode.py +++ b/openrouteservice/legacy/geocode.py @@ -17,7 +17,7 @@ # the License. # """Performs requests to the ORS geocode API (direct Pelias clone).""" -from openrouteservice import convert +from openrouteservice.legacy import convert, deprecation def pelias_search( @@ -93,6 +93,8 @@ def pelias_search( :rtype: call to Client.request() """ + deprecation.deprecated("Client.pelias_search", "GeocodeApi.geocode_search_get") + params = {"text": text} if focus_point: @@ -202,6 +204,8 @@ def pelias_autocomplete( :rtype: dict from JSON response """ + deprecation.deprecated("Client.pelias_autocomplete", "GeocodeApi.geocode_autocomplete_get") + params = {"text": text} if focus_point: @@ -295,6 +299,8 @@ def pelias_structured( :rtype: dict from JSON response """ + deprecation.deprecated("Client.pelias_structured", "GeocodeApi.geocode_search_structured_get") + params = {} if address: @@ -371,6 +377,8 @@ def pelias_reverse( :rtype: dict from JSON response """ + deprecation.deprecated("Client.pelias_reverse", "GeocodeApi.geocode_reverse_get") + params = { "point.lon": convert._format_float(point[0]), "point.lat": convert._format_float(point[1]), diff --git a/openrouteservice/isochrones.py b/openrouteservice/legacy/isochrones.py similarity index 97% rename from openrouteservice/isochrones.py rename to openrouteservice/legacy/isochrones.py index 31819632..46950b52 100644 --- a/openrouteservice/isochrones.py +++ b/openrouteservice/legacy/isochrones.py @@ -16,7 +16,7 @@ # """Performs requests to the ORS isochrones API.""" -from openrouteservice import deprecation +from openrouteservice.legacy import deprecation def isochrones( @@ -107,6 +107,8 @@ def isochrones( :rtype: call to Client.request() """ + deprecation.deprecated("Client.isochrones", "IsochronesServiceApi.get_default_isochrones") + params = {"locations": locations} if profile: # pragma: no cover diff --git a/openrouteservice/optimization.py b/openrouteservice/legacy/optimization.py similarity index 98% rename from openrouteservice/optimization.py rename to openrouteservice/legacy/optimization.py index 57b337b4..777cedda 100644 --- a/openrouteservice/optimization.py +++ b/openrouteservice/legacy/optimization.py @@ -17,6 +17,9 @@ """Performs requests to the ORS optimization API.""" +from openrouteservice.legacy import deprecation + + def optimization( client, jobs=None, @@ -65,6 +68,8 @@ def optimization( :rtype: dict """ + deprecation.deprecated("Client.optimization", "OptimizationApi.optimization_post") + assert all([isinstance(x, Vehicle) for x in vehicles]) # noqa params = {"vehicles": [vehicle.__dict__ for vehicle in vehicles]} diff --git a/openrouteservice/places.py b/openrouteservice/legacy/places.py similarity index 96% rename from openrouteservice/places.py rename to openrouteservice/legacy/places.py index 0d434879..dbde0ac1 100644 --- a/openrouteservice/places.py +++ b/openrouteservice/legacy/places.py @@ -15,7 +15,7 @@ # the License. """Performs requests to the ORS Places API.""" -from openrouteservice import convert +from openrouteservice.legacy import convert, deprecation def places( @@ -80,6 +80,8 @@ def places( :rtype: call to Client.request() """ + deprecation.deprecated("Client.places", "PoisApi.pois_post") + params = { "request": request, "filters": {}, diff --git a/openrouteservice/models/__init__.py b/openrouteservice/models/__init__.py new file mode 100644 index 00000000..ce6bc4ce --- /dev/null +++ b/openrouteservice/models/__init__.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +# flake8: noqa +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +# import models into model package +from openrouteservice.models.alternative_routes import AlternativeRoutes +from openrouteservice.models.directions_service_body import DirectionsServiceBody +from openrouteservice.models.elevation_line_body import ElevationLineBody +from openrouteservice.models.elevation_point_body import ElevationPointBody +from openrouteservice.models.isochrones_profile_body import IsochronesProfileBody +from openrouteservice.models.json_response import JSONResponse +from openrouteservice.models.matrix_profile_body import MatrixProfileBody +from openrouteservice.models.openpoiservice_poi_request import OpenpoiservicePoiRequest +from openrouteservice.models.optimization_body import OptimizationBody +from openrouteservice.models.optimization_breaks import OptimizationBreaks +from openrouteservice.models.optimization_costs import OptimizationCosts +from openrouteservice.models.optimization_jobs import OptimizationJobs +from openrouteservice.models.optimization_matrices import OptimizationMatrices +from openrouteservice.models.optimization_matrices_cyclingelectric import OptimizationMatricesCyclingelectric +from openrouteservice.models.optimization_options import OptimizationOptions +from openrouteservice.models.optimization_steps import OptimizationSteps +from openrouteservice.models.optimization_vehicles import OptimizationVehicles +from openrouteservice.models.pois_filters import PoisFilters +from openrouteservice.models.pois_geometry import PoisGeometry +from openrouteservice.models.profile_geojson_body import ProfileGeojsonBody +from openrouteservice.models.profile_json_body import ProfileJsonBody +from openrouteservice.models.profile_parameters import ProfileParameters +from openrouteservice.models.profile_parameters_restrictions import ProfileParametersRestrictions +from openrouteservice.models.profile_weightings import ProfileWeightings +from openrouteservice.models.round_trip_route_options import RoundTripRouteOptions +from openrouteservice.models.route_options import RouteOptions +from openrouteservice.models.route_options_avoid_polygons import RouteOptionsAvoidPolygons +from openrouteservice.models.snap_profile_body import SnapProfileBody diff --git a/openrouteservice/models/alternative_routes.py b/openrouteservice/models/alternative_routes.py new file mode 100644 index 00000000..fa2f3c6e --- /dev/null +++ b/openrouteservice/models/alternative_routes.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class AlternativeRoutes(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'share_factor': 'float', + 'target_count': 'int', + 'weight_factor': 'float' + } + + attribute_map = { + 'share_factor': 'share_factor', + 'target_count': 'target_count', + 'weight_factor': 'weight_factor' + } + + def __init__(self, share_factor=None, target_count=None, weight_factor=None): # noqa: E501 + """AlternativeRoutes - a model defined in Swagger""" # noqa: E501 + self._share_factor = None + self._target_count = None + self._weight_factor = None + self.discriminator = None + if share_factor is not None: + self.share_factor = share_factor + if target_count is not None: + self.target_count = target_count + if weight_factor is not None: + self.weight_factor = weight_factor + + @property + def share_factor(self): + """Gets the share_factor of this AlternativeRoutes. # noqa: E501 + + Maximum fraction of the route that alternatives may share with the optimal route. The default value of 0.6 means alternatives can share up to 60% of path segments with the optimal route. # noqa: E501 + + :return: The share_factor of this AlternativeRoutes. # noqa: E501 + :rtype: float + """ + return self._share_factor + + @share_factor.setter + def share_factor(self, share_factor): + """Sets the share_factor of this AlternativeRoutes. + + Maximum fraction of the route that alternatives may share with the optimal route. The default value of 0.6 means alternatives can share up to 60% of path segments with the optimal route. # noqa: E501 + + :param share_factor: The share_factor of this AlternativeRoutes. # noqa: E501 + :type: float + """ + + self._share_factor = share_factor + + @property + def target_count(self): + """Gets the target_count of this AlternativeRoutes. # noqa: E501 + + Target number of alternative routes to compute. Service returns up to this number of routes that fulfill the share-factor and weight-factor constraints. # noqa: E501 + + :return: The target_count of this AlternativeRoutes. # noqa: E501 + :rtype: int + """ + return self._target_count + + @target_count.setter + def target_count(self, target_count): + """Sets the target_count of this AlternativeRoutes. + + Target number of alternative routes to compute. Service returns up to this number of routes that fulfill the share-factor and weight-factor constraints. # noqa: E501 + + :param target_count: The target_count of this AlternativeRoutes. # noqa: E501 + :type: int + """ + + self._target_count = target_count + + @property + def weight_factor(self): + """Gets the weight_factor of this AlternativeRoutes. # noqa: E501 + + Maximum factor by which route weight may diverge from the optimal route. The default value of 1.4 means alternatives can be up to 1.4 times longer (costly) than the optimal route. # noqa: E501 + + :return: The weight_factor of this AlternativeRoutes. # noqa: E501 + :rtype: float + """ + return self._weight_factor + + @weight_factor.setter + def weight_factor(self, weight_factor): + """Sets the weight_factor of this AlternativeRoutes. + + Maximum factor by which route weight may diverge from the optimal route. The default value of 1.4 means alternatives can be up to 1.4 times longer (costly) than the optimal route. # noqa: E501 + + :param weight_factor: The weight_factor of this AlternativeRoutes. # noqa: E501 + :type: float + """ + + self._weight_factor = weight_factor + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlternativeRoutes, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlternativeRoutes): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/directions_service_body.py b/openrouteservice/models/directions_service_body.py new file mode 100644 index 00000000..29929676 --- /dev/null +++ b/openrouteservice/models/directions_service_body.py @@ -0,0 +1,875 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class DirectionsServiceBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alternative_routes': 'AlternativeRoutes', + 'attributes': 'list[str]', + 'bearings': 'list[list[float]]', + 'continue_straight': 'bool', + 'coordinates': 'list[list[float]]', + 'elevation': 'bool', + 'extra_info': 'list[str]', + 'geometry': 'bool', + 'geometry_simplify': 'bool', + 'id': 'str', + 'ignore_transfers': 'bool', + 'instructions': 'bool', + 'instructions_format': 'str', + 'language': 'str', + 'maneuvers': 'bool', + 'maximum_speed': 'float', + 'options': 'RouteOptions', + 'preference': 'str', + 'radiuses': 'list[float]', + 'roundabout_exits': 'bool', + 'schedule': 'bool', + 'schedule_duration': 'str', + 'schedule_rows': 'int', + 'skip_segments': 'list[int]', + 'suppress_warnings': 'bool', + 'units': 'str', + 'walking_time': 'str' + } + + attribute_map = { + 'alternative_routes': 'alternative_routes', + 'attributes': 'attributes', + 'bearings': 'bearings', + 'continue_straight': 'continue_straight', + 'coordinates': 'coordinates', + 'elevation': 'elevation', + 'extra_info': 'extra_info', + 'geometry': 'geometry', + 'geometry_simplify': 'geometry_simplify', + 'id': 'id', + 'ignore_transfers': 'ignore_transfers', + 'instructions': 'instructions', + 'instructions_format': 'instructions_format', + 'language': 'language', + 'maneuvers': 'maneuvers', + 'maximum_speed': 'maximum_speed', + 'options': 'options', + 'preference': 'preference', + 'radiuses': 'radiuses', + 'roundabout_exits': 'roundabout_exits', + 'schedule': 'schedule', + 'schedule_duration': 'schedule_duration', + 'schedule_rows': 'schedule_rows', + 'skip_segments': 'skip_segments', + 'suppress_warnings': 'suppress_warnings', + 'units': 'units', + 'walking_time': 'walking_time' + } + + def __init__(self, alternative_routes=None, attributes=None, bearings=None, continue_straight=False, coordinates=None, elevation=None, extra_info=None, geometry=True, geometry_simplify=False, id=None, ignore_transfers=False, instructions=True, instructions_format='text', language='en', maneuvers=False, maximum_speed=None, options=None, preference='recommended', radiuses=None, roundabout_exits=False, schedule=False, schedule_duration=None, schedule_rows=None, skip_segments=None, suppress_warnings=None, units='m', walking_time='PT15M'): # noqa: E501 + """DirectionsServiceBody - a model defined in Swagger""" # noqa: E501 + self._alternative_routes = None + self._attributes = None + self._bearings = None + self._continue_straight = None + self._coordinates = None + self._elevation = None + self._extra_info = None + self._geometry = None + self._geometry_simplify = None + self._id = None + self._ignore_transfers = None + self._instructions = None + self._instructions_format = None + self._language = None + self._maneuvers = None + self._maximum_speed = None + self._options = None + self._preference = None + self._radiuses = None + self._roundabout_exits = None + self._schedule = None + self._schedule_duration = None + self._schedule_rows = None + self._skip_segments = None + self._suppress_warnings = None + self._units = None + self._walking_time = None + self.discriminator = None + if alternative_routes is not None: + self.alternative_routes = alternative_routes + if attributes is not None: + self.attributes = attributes + if bearings is not None: + self.bearings = bearings + if continue_straight is not None: + self.continue_straight = continue_straight + self.coordinates = coordinates + if elevation is not None: + self.elevation = elevation + if extra_info is not None: + self.extra_info = extra_info + if geometry is not None: + self.geometry = geometry + if geometry_simplify is not None: + self.geometry_simplify = geometry_simplify + if id is not None: + self.id = id + if ignore_transfers is not None: + self.ignore_transfers = ignore_transfers + if instructions is not None: + self.instructions = instructions + if instructions_format is not None: + self.instructions_format = instructions_format + if language is not None: + self.language = language + if maneuvers is not None: + self.maneuvers = maneuvers + if maximum_speed is not None: + self.maximum_speed = maximum_speed + if options is not None: + self.options = options + if preference is not None: + self.preference = preference + if radiuses is not None: + self.radiuses = radiuses + if roundabout_exits is not None: + self.roundabout_exits = roundabout_exits + if schedule is not None: + self.schedule = schedule + if schedule_duration is not None: + self.schedule_duration = schedule_duration + if schedule_rows is not None: + self.schedule_rows = schedule_rows + if skip_segments is not None: + self.skip_segments = skip_segments + if suppress_warnings is not None: + self.suppress_warnings = suppress_warnings + if units is not None: + self.units = units + if walking_time is not None: + self.walking_time = walking_time + + @property + def alternative_routes(self): + """Gets the alternative_routes of this DirectionsServiceBody. # noqa: E501 + + + :return: The alternative_routes of this DirectionsServiceBody. # noqa: E501 + :rtype: AlternativeRoutes + """ + return self._alternative_routes + + @alternative_routes.setter + def alternative_routes(self, alternative_routes): + """Sets the alternative_routes of this DirectionsServiceBody. + + + :param alternative_routes: The alternative_routes of this DirectionsServiceBody. # noqa: E501 + :type: AlternativeRoutes + """ + + self._alternative_routes = alternative_routes + + @property + def attributes(self): + """Gets the attributes of this DirectionsServiceBody. # noqa: E501 + + List of route attributes # noqa: E501 + + :return: The attributes of this DirectionsServiceBody. # noqa: E501 + :rtype: list[str] + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this DirectionsServiceBody. + + List of route attributes # noqa: E501 + + :param attributes: The attributes of this DirectionsServiceBody. # noqa: E501 + :type: list[str] + """ + allowed_values = ["avgspeed", "detourfactor", "percentage"] # noqa: E501 + if not set(attributes).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `attributes` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(attributes) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._attributes = attributes + + @property + def bearings(self): + """Gets the bearings of this DirectionsServiceBody. # noqa: E501 + + Specifies a list of pairs (bearings and deviations) to filter the segments of the road network a waypoint can snap to. \"For example `bearings=[[45,10],[120,20]]`. \"Each pair is a comma-separated list that can consist of one or two float values, where the first value is the bearing and the second one is the allowed deviation from the bearing. \"The bearing can take values between `0` and `360` clockwise from true north. If the deviation is not set, then the default value of `100` degrees is used. \"The number of pairs must correspond to the number of waypoints. \"The number of bearings corresponds to the length of waypoints-1 or waypoints. If the bearing information for the last waypoint is given, then this will control the sector from which the destination waypoint may be reached. \"You can skip a bearing for a certain waypoint by passing an empty value for an array, e.g. `[30,20],[],[40,20]`. # noqa: E501 + + :return: The bearings of this DirectionsServiceBody. # noqa: E501 + :rtype: list[list[float]] + """ + return self._bearings + + @bearings.setter + def bearings(self, bearings): + """Sets the bearings of this DirectionsServiceBody. + + Specifies a list of pairs (bearings and deviations) to filter the segments of the road network a waypoint can snap to. \"For example `bearings=[[45,10],[120,20]]`. \"Each pair is a comma-separated list that can consist of one or two float values, where the first value is the bearing and the second one is the allowed deviation from the bearing. \"The bearing can take values between `0` and `360` clockwise from true north. If the deviation is not set, then the default value of `100` degrees is used. \"The number of pairs must correspond to the number of waypoints. \"The number of bearings corresponds to the length of waypoints-1 or waypoints. If the bearing information for the last waypoint is given, then this will control the sector from which the destination waypoint may be reached. \"You can skip a bearing for a certain waypoint by passing an empty value for an array, e.g. `[30,20],[],[40,20]`. # noqa: E501 + + :param bearings: The bearings of this DirectionsServiceBody. # noqa: E501 + :type: list[list[float]] + """ + + self._bearings = bearings + + @property + def continue_straight(self): + """Gets the continue_straight of this DirectionsServiceBody. # noqa: E501 + + Forces the route to keep going straight at waypoints restricting uturns there even if it would be faster. # noqa: E501 + + :return: The continue_straight of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._continue_straight + + @continue_straight.setter + def continue_straight(self, continue_straight): + """Sets the continue_straight of this DirectionsServiceBody. + + Forces the route to keep going straight at waypoints restricting uturns there even if it would be faster. # noqa: E501 + + :param continue_straight: The continue_straight of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._continue_straight = continue_straight + + @property + def coordinates(self): + """Gets the coordinates of this DirectionsServiceBody. # noqa: E501 + + The waypoints to use for the route as an array of `longitude/latitude` pairs in WGS 84 (EPSG:4326) # noqa: E501 + + :return: The coordinates of this DirectionsServiceBody. # noqa: E501 + :rtype: list[list[float]] + """ + return self._coordinates + + @coordinates.setter + def coordinates(self, coordinates): + """Sets the coordinates of this DirectionsServiceBody. + + The waypoints to use for the route as an array of `longitude/latitude` pairs in WGS 84 (EPSG:4326) # noqa: E501 + + :param coordinates: The coordinates of this DirectionsServiceBody. # noqa: E501 + :type: list[list[float]] + """ + if coordinates is None: + raise ValueError("Invalid value for `coordinates`, must not be `None`") # noqa: E501 + + self._coordinates = coordinates + + @property + def elevation(self): + """Gets the elevation of this DirectionsServiceBody. # noqa: E501 + + Specifies whether to return elevation values for points. Please note that elevation also gets encoded for json response encoded polyline. # noqa: E501 + + :return: The elevation of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._elevation + + @elevation.setter + def elevation(self, elevation): + """Sets the elevation of this DirectionsServiceBody. + + Specifies whether to return elevation values for points. Please note that elevation also gets encoded for json response encoded polyline. # noqa: E501 + + :param elevation: The elevation of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._elevation = elevation + + @property + def extra_info(self): + """Gets the extra_info of this DirectionsServiceBody. # noqa: E501 + + The extra info items to include in the response # noqa: E501 + + :return: The extra_info of this DirectionsServiceBody. # noqa: E501 + :rtype: list[str] + """ + return self._extra_info + + @extra_info.setter + def extra_info(self, extra_info): + """Sets the extra_info of this DirectionsServiceBody. + + The extra info items to include in the response # noqa: E501 + + :param extra_info: The extra_info of this DirectionsServiceBody. # noqa: E501 + :type: list[str] + """ + allowed_values = ["steepness", "suitability", "surface", "waycategory", "waytype", "tollways", "traildifficulty", "osmid", "roadaccessrestrictions", "countryinfo", "green", "noise", "csv", "shadow"] # noqa: E501 + if not set(extra_info).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `extra_info` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(extra_info) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._extra_info = extra_info + + @property + def geometry(self): + """Gets the geometry of this DirectionsServiceBody. # noqa: E501 + + Specifies whether to return geometry. # noqa: E501 + + :return: The geometry of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._geometry + + @geometry.setter + def geometry(self, geometry): + """Sets the geometry of this DirectionsServiceBody. + + Specifies whether to return geometry. # noqa: E501 + + :param geometry: The geometry of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._geometry = geometry + + @property + def geometry_simplify(self): + """Gets the geometry_simplify of this DirectionsServiceBody. # noqa: E501 + + Specifies whether to simplify the geometry. Simplify geometry cannot be applied to routes with more than **one segment** and when `extra_info` is required. # noqa: E501 + + :return: The geometry_simplify of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._geometry_simplify + + @geometry_simplify.setter + def geometry_simplify(self, geometry_simplify): + """Sets the geometry_simplify of this DirectionsServiceBody. + + Specifies whether to simplify the geometry. Simplify geometry cannot be applied to routes with more than **one segment** and when `extra_info` is required. # noqa: E501 + + :param geometry_simplify: The geometry_simplify of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._geometry_simplify = geometry_simplify + + @property + def id(self): + """Gets the id of this DirectionsServiceBody. # noqa: E501 + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :return: The id of this DirectionsServiceBody. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DirectionsServiceBody. + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :param id: The id of this DirectionsServiceBody. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def ignore_transfers(self): + """Gets the ignore_transfers of this DirectionsServiceBody. # noqa: E501 + + Specifies if transfers as criterion should be ignored. # noqa: E501 + + :return: The ignore_transfers of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._ignore_transfers + + @ignore_transfers.setter + def ignore_transfers(self, ignore_transfers): + """Sets the ignore_transfers of this DirectionsServiceBody. + + Specifies if transfers as criterion should be ignored. # noqa: E501 + + :param ignore_transfers: The ignore_transfers of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._ignore_transfers = ignore_transfers + + @property + def instructions(self): + """Gets the instructions of this DirectionsServiceBody. # noqa: E501 + + Specifies whether to return instructions. # noqa: E501 + + :return: The instructions of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._instructions + + @instructions.setter + def instructions(self, instructions): + """Sets the instructions of this DirectionsServiceBody. + + Specifies whether to return instructions. # noqa: E501 + + :param instructions: The instructions of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._instructions = instructions + + @property + def instructions_format(self): + """Gets the instructions_format of this DirectionsServiceBody. # noqa: E501 + + Select html for more verbose instructions. # noqa: E501 + + :return: The instructions_format of this DirectionsServiceBody. # noqa: E501 + :rtype: str + """ + return self._instructions_format + + @instructions_format.setter + def instructions_format(self, instructions_format): + """Sets the instructions_format of this DirectionsServiceBody. + + Select html for more verbose instructions. # noqa: E501 + + :param instructions_format: The instructions_format of this DirectionsServiceBody. # noqa: E501 + :type: str + """ + allowed_values = ["html", "text"] # noqa: E501 + if instructions_format not in allowed_values: + raise ValueError( + "Invalid value for `instructions_format` ({0}), must be one of {1}" # noqa: E501 + .format(instructions_format, allowed_values) + ) + + self._instructions_format = instructions_format + + @property + def language(self): + """Gets the language of this DirectionsServiceBody. # noqa: E501 + + Language for the route instructions. # noqa: E501 + + :return: The language of this DirectionsServiceBody. # noqa: E501 + :rtype: str + """ + return self._language + + @language.setter + def language(self, language): + """Sets the language of this DirectionsServiceBody. + + Language for the route instructions. # noqa: E501 + + :param language: The language of this DirectionsServiceBody. # noqa: E501 + :type: str + """ + allowed_values = ["cs", "cs-cz", "da", "dk-da", "de", "de-de", "en", "en-us", "eo", "eo-eo", "es", "es-es", "fi", "fi-fi", "fr", "fr-fr", "gr", "gr-gr", "he", "he-il", "hu", "hu-hu", "id", "id-id", "it", "it-it", "ja", "ja-jp", "ne", "ne-np", "nl", "nl-nl", "nb", "nb-no", "pl", "pl-pl", "pt", "pt-pt", "ro", "ro-ro", "ru", "ru-ru", "tr", "tr-tr", "vi", "vi-vn", "zh", "zh-cn"] # noqa: E501 + if language not in allowed_values: + raise ValueError( + "Invalid value for `language` ({0}), must be one of {1}" # noqa: E501 + .format(language, allowed_values) + ) + + self._language = language + + @property + def maneuvers(self): + """Gets the maneuvers of this DirectionsServiceBody. # noqa: E501 + + Specifies whether the maneuver object is included into the step object or not. # noqa: E501 + + :return: The maneuvers of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._maneuvers + + @maneuvers.setter + def maneuvers(self, maneuvers): + """Sets the maneuvers of this DirectionsServiceBody. + + Specifies whether the maneuver object is included into the step object or not. # noqa: E501 + + :param maneuvers: The maneuvers of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._maneuvers = maneuvers + + @property + def maximum_speed(self): + """Gets the maximum_speed of this DirectionsServiceBody. # noqa: E501 + + The maximum speed specified by user. # noqa: E501 + + :return: The maximum_speed of this DirectionsServiceBody. # noqa: E501 + :rtype: float + """ + return self._maximum_speed + + @maximum_speed.setter + def maximum_speed(self, maximum_speed): + """Sets the maximum_speed of this DirectionsServiceBody. + + The maximum speed specified by user. # noqa: E501 + + :param maximum_speed: The maximum_speed of this DirectionsServiceBody. # noqa: E501 + :type: float + """ + + self._maximum_speed = maximum_speed + + @property + def options(self): + """Gets the options of this DirectionsServiceBody. # noqa: E501 + + + :return: The options of this DirectionsServiceBody. # noqa: E501 + :rtype: RouteOptions + """ + return self._options + + @options.setter + def options(self, options): + """Sets the options of this DirectionsServiceBody. + + + :param options: The options of this DirectionsServiceBody. # noqa: E501 + :type: RouteOptions + """ + + self._options = options + + @property + def preference(self): + """Gets the preference of this DirectionsServiceBody. # noqa: E501 + + Specifies the route preference # noqa: E501 + + :return: The preference of this DirectionsServiceBody. # noqa: E501 + :rtype: str + """ + return self._preference + + @preference.setter + def preference(self, preference): + """Sets the preference of this DirectionsServiceBody. + + Specifies the route preference # noqa: E501 + + :param preference: The preference of this DirectionsServiceBody. # noqa: E501 + :type: str + """ + allowed_values = ["fastest", "shortest", "recommended"] # noqa: E501 + if preference not in allowed_values: + raise ValueError( + "Invalid value for `preference` ({0}), must be one of {1}" # noqa: E501 + .format(preference, allowed_values) + ) + + self._preference = preference + + @property + def radiuses(self): + """Gets the radiuses of this DirectionsServiceBody. # noqa: E501 + + A list of maximum distances (measured in metres) that limit the search of nearby road segments to every given waypoint. The values must be greater than 0, the value of -1 specifies using the maximum possible search radius. The number of radiuses correspond to the number of waypoints. If only a single value is given, it will be applied to all waypoints. # noqa: E501 + + :return: The radiuses of this DirectionsServiceBody. # noqa: E501 + :rtype: list[float] + """ + return self._radiuses + + @radiuses.setter + def radiuses(self, radiuses): + """Sets the radiuses of this DirectionsServiceBody. + + A list of maximum distances (measured in metres) that limit the search of nearby road segments to every given waypoint. The values must be greater than 0, the value of -1 specifies using the maximum possible search radius. The number of radiuses correspond to the number of waypoints. If only a single value is given, it will be applied to all waypoints. # noqa: E501 + + :param radiuses: The radiuses of this DirectionsServiceBody. # noqa: E501 + :type: list[float] + """ + + self._radiuses = radiuses + + @property + def roundabout_exits(self): + """Gets the roundabout_exits of this DirectionsServiceBody. # noqa: E501 + + Provides bearings of the entrance and all passed roundabout exits. Adds the `exit_bearings` array to the step object in the response. # noqa: E501 + + :return: The roundabout_exits of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._roundabout_exits + + @roundabout_exits.setter + def roundabout_exits(self, roundabout_exits): + """Sets the roundabout_exits of this DirectionsServiceBody. + + Provides bearings of the entrance and all passed roundabout exits. Adds the `exit_bearings` array to the step object in the response. # noqa: E501 + + :param roundabout_exits: The roundabout_exits of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._roundabout_exits = roundabout_exits + + @property + def schedule(self): + """Gets the schedule of this DirectionsServiceBody. # noqa: E501 + + If true, return a public transport schedule starting at for the next minutes. # noqa: E501 + + :return: The schedule of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this DirectionsServiceBody. + + If true, return a public transport schedule starting at for the next minutes. # noqa: E501 + + :param schedule: The schedule of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._schedule = schedule + + @property + def schedule_duration(self): + """Gets the schedule_duration of this DirectionsServiceBody. # noqa: E501 + + The time window when requesting a public transport schedule. The format is passed as ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations # noqa: E501 + + :return: The schedule_duration of this DirectionsServiceBody. # noqa: E501 + :rtype: str + """ + return self._schedule_duration + + @schedule_duration.setter + def schedule_duration(self, schedule_duration): + """Sets the schedule_duration of this DirectionsServiceBody. + + The time window when requesting a public transport schedule. The format is passed as ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations # noqa: E501 + + :param schedule_duration: The schedule_duration of this DirectionsServiceBody. # noqa: E501 + :type: str + """ + + self._schedule_duration = schedule_duration + + @property + def schedule_rows(self): + """Gets the schedule_rows of this DirectionsServiceBody. # noqa: E501 + + The maximum amount of entries that should be returned when requesting a schedule. # noqa: E501 + + :return: The schedule_rows of this DirectionsServiceBody. # noqa: E501 + :rtype: int + """ + return self._schedule_rows + + @schedule_rows.setter + def schedule_rows(self, schedule_rows): + """Sets the schedule_rows of this DirectionsServiceBody. + + The maximum amount of entries that should be returned when requesting a schedule. # noqa: E501 + + :param schedule_rows: The schedule_rows of this DirectionsServiceBody. # noqa: E501 + :type: int + """ + + self._schedule_rows = schedule_rows + + @property + def skip_segments(self): + """Gets the skip_segments of this DirectionsServiceBody. # noqa: E501 + + Specifies the segments that should be skipped in the route calculation. A segment is the connection between two given coordinates and the counting starts with 1 for the connection between the first and second coordinate. # noqa: E501 + + :return: The skip_segments of this DirectionsServiceBody. # noqa: E501 + :rtype: list[int] + """ + return self._skip_segments + + @skip_segments.setter + def skip_segments(self, skip_segments): + """Sets the skip_segments of this DirectionsServiceBody. + + Specifies the segments that should be skipped in the route calculation. A segment is the connection between two given coordinates and the counting starts with 1 for the connection between the first and second coordinate. # noqa: E501 + + :param skip_segments: The skip_segments of this DirectionsServiceBody. # noqa: E501 + :type: list[int] + """ + + self._skip_segments = skip_segments + + @property + def suppress_warnings(self): + """Gets the suppress_warnings of this DirectionsServiceBody. # noqa: E501 + + Suppress warning messages in the response # noqa: E501 + + :return: The suppress_warnings of this DirectionsServiceBody. # noqa: E501 + :rtype: bool + """ + return self._suppress_warnings + + @suppress_warnings.setter + def suppress_warnings(self, suppress_warnings): + """Sets the suppress_warnings of this DirectionsServiceBody. + + Suppress warning messages in the response # noqa: E501 + + :param suppress_warnings: The suppress_warnings of this DirectionsServiceBody. # noqa: E501 + :type: bool + """ + + self._suppress_warnings = suppress_warnings + + @property + def units(self): + """Gets the units of this DirectionsServiceBody. # noqa: E501 + + Specifies the distance unit. # noqa: E501 + + :return: The units of this DirectionsServiceBody. # noqa: E501 + :rtype: str + """ + return self._units + + @units.setter + def units(self, units): + """Sets the units of this DirectionsServiceBody. + + Specifies the distance unit. # noqa: E501 + + :param units: The units of this DirectionsServiceBody. # noqa: E501 + :type: str + """ + allowed_values = ["m", "km", "mi"] # noqa: E501 + if units not in allowed_values: + raise ValueError( + "Invalid value for `units` ({0}), must be one of {1}" # noqa: E501 + .format(units, allowed_values) + ) + + self._units = units + + @property + def walking_time(self): + """Gets the walking_time of this DirectionsServiceBody. # noqa: E501 + + Maximum duration for walking access and egress of public transport. The value is passed in ISO 8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations # noqa: E501 + + :return: The walking_time of this DirectionsServiceBody. # noqa: E501 + :rtype: str + """ + return self._walking_time + + @walking_time.setter + def walking_time(self, walking_time): + """Sets the walking_time of this DirectionsServiceBody. + + Maximum duration for walking access and egress of public transport. The value is passed in ISO 8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations # noqa: E501 + + :param walking_time: The walking_time of this DirectionsServiceBody. # noqa: E501 + :type: str + """ + + self._walking_time = walking_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DirectionsServiceBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DirectionsServiceBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/elevation_line_body.py b/openrouteservice/models/elevation_line_body.py new file mode 100644 index 00000000..fc7338db --- /dev/null +++ b/openrouteservice/models/elevation_line_body.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class ElevationLineBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dataset': 'str', + 'format_in': 'str', + 'format_out': 'str', + 'geometry': 'object' + } + + attribute_map = { + 'dataset': 'dataset', + 'format_in': 'format_in', + 'format_out': 'format_out', + 'geometry': 'geometry' + } + + def __init__(self, dataset='srtm', format_in=None, format_out='geojson', geometry=None): # noqa: E501 + """ElevationLineBody - a model defined in Swagger""" # noqa: E501 + self._dataset = None + self._format_in = None + self._format_out = None + self._geometry = None + self.discriminator = None + if dataset is not None: + self.dataset = dataset + self.format_in = format_in + if format_out is not None: + self.format_out = format_out + self.geometry = geometry + + @property + def dataset(self): + """Gets the dataset of this ElevationLineBody. # noqa: E501 + + The elevation dataset to be used. # noqa: E501 + + :return: The dataset of this ElevationLineBody. # noqa: E501 + :rtype: str + """ + return self._dataset + + @dataset.setter + def dataset(self, dataset): + """Sets the dataset of this ElevationLineBody. + + The elevation dataset to be used. # noqa: E501 + + :param dataset: The dataset of this ElevationLineBody. # noqa: E501 + :type: str + """ + allowed_values = ["srtm"] # noqa: E501 + if dataset not in allowed_values: + raise ValueError( + "Invalid value for `dataset` ({0}), must be one of {1}" # noqa: E501 + .format(dataset, allowed_values) + ) + + self._dataset = dataset + + @property + def format_in(self): + """Gets the format_in of this ElevationLineBody. # noqa: E501 + + The input format the API has to expect. # noqa: E501 + + :return: The format_in of this ElevationLineBody. # noqa: E501 + :rtype: str + """ + return self._format_in + + @format_in.setter + def format_in(self, format_in): + """Sets the format_in of this ElevationLineBody. + + The input format the API has to expect. # noqa: E501 + + :param format_in: The format_in of this ElevationLineBody. # noqa: E501 + :type: str + """ + if format_in is None: + raise ValueError("Invalid value for `format_in`, must not be `None`") # noqa: E501 + allowed_values = ["geojson", "polyline", "encodedpolyline5", "encodedpolyline6"] # noqa: E501 + if format_in not in allowed_values: + raise ValueError( + "Invalid value for `format_in` ({0}), must be one of {1}" # noqa: E501 + .format(format_in, allowed_values) + ) + + self._format_in = format_in + + @property + def format_out(self): + """Gets the format_out of this ElevationLineBody. # noqa: E501 + + The output format to be returned. # noqa: E501 + + :return: The format_out of this ElevationLineBody. # noqa: E501 + :rtype: str + """ + return self._format_out + + @format_out.setter + def format_out(self, format_out): + """Sets the format_out of this ElevationLineBody. + + The output format to be returned. # noqa: E501 + + :param format_out: The format_out of this ElevationLineBody. # noqa: E501 + :type: str + """ + allowed_values = ["geojson", "polyline", "encodedpolyline5", "encodedpolyline6"] # noqa: E501 + if format_out not in allowed_values: + raise ValueError( + "Invalid value for `format_out` ({0}), must be one of {1}" # noqa: E501 + .format(format_out, allowed_values) + ) + + self._format_out = format_out + + @property + def geometry(self): + """Gets the geometry of this ElevationLineBody. # noqa: E501 + + * geojson: A geometry object of a LineString GeoJSON, e.g. {\"type\": \"LineString\", \"coordinates\": [[13.331302, 38.108433],[13.331273, 38.10849]] } * polyline: A list of coordinate lists, e.g. [[13.331302, 38.108433], [13.331273, 38.10849]] * encodedpolyline5: A Google encoded polyline with a coordinate precision of 5, e.g. u`rgFswjpAKD * encodedpolyline6: A Google encoded polyline with a coordinate precision of 6, e.g. ap}tgAkutlXqBx@ # noqa: E501 + + :return: The geometry of this ElevationLineBody. # noqa: E501 + :rtype: object + """ + return self._geometry + + @geometry.setter + def geometry(self, geometry): + """Sets the geometry of this ElevationLineBody. + + * geojson: A geometry object of a LineString GeoJSON, e.g. {\"type\": \"LineString\", \"coordinates\": [[13.331302, 38.108433],[13.331273, 38.10849]] } * polyline: A list of coordinate lists, e.g. [[13.331302, 38.108433], [13.331273, 38.10849]] * encodedpolyline5: A Google encoded polyline with a coordinate precision of 5, e.g. u`rgFswjpAKD * encodedpolyline6: A Google encoded polyline with a coordinate precision of 6, e.g. ap}tgAkutlXqBx@ # noqa: E501 + + :param geometry: The geometry of this ElevationLineBody. # noqa: E501 + :type: object + """ + if geometry is None: + raise ValueError("Invalid value for `geometry`, must not be `None`") # noqa: E501 + + self._geometry = geometry + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ElevationLineBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ElevationLineBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/elevation_point_body.py b/openrouteservice/models/elevation_point_body.py new file mode 100644 index 00000000..7a88e4c6 --- /dev/null +++ b/openrouteservice/models/elevation_point_body.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class ElevationPointBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dataset': 'str', + 'format_in': 'str', + 'format_out': 'str', + 'geometry': 'object' + } + + attribute_map = { + 'dataset': 'dataset', + 'format_in': 'format_in', + 'format_out': 'format_out', + 'geometry': 'geometry' + } + + def __init__(self, dataset='srtm', format_in=None, format_out='geojson', geometry=None): # noqa: E501 + """ElevationPointBody - a model defined in Swagger""" # noqa: E501 + self._dataset = None + self._format_in = None + self._format_out = None + self._geometry = None + self.discriminator = None + if dataset is not None: + self.dataset = dataset + self.format_in = format_in + if format_out is not None: + self.format_out = format_out + self.geometry = geometry + + @property + def dataset(self): + """Gets the dataset of this ElevationPointBody. # noqa: E501 + + The elevation dataset to be used. # noqa: E501 + + :return: The dataset of this ElevationPointBody. # noqa: E501 + :rtype: str + """ + return self._dataset + + @dataset.setter + def dataset(self, dataset): + """Sets the dataset of this ElevationPointBody. + + The elevation dataset to be used. # noqa: E501 + + :param dataset: The dataset of this ElevationPointBody. # noqa: E501 + :type: str + """ + allowed_values = ["srtm"] # noqa: E501 + if dataset not in allowed_values: + raise ValueError( + "Invalid value for `dataset` ({0}), must be one of {1}" # noqa: E501 + .format(dataset, allowed_values) + ) + + self._dataset = dataset + + @property + def format_in(self): + """Gets the format_in of this ElevationPointBody. # noqa: E501 + + The input format the API has to expect. # noqa: E501 + + :return: The format_in of this ElevationPointBody. # noqa: E501 + :rtype: str + """ + return self._format_in + + @format_in.setter + def format_in(self, format_in): + """Sets the format_in of this ElevationPointBody. + + The input format the API has to expect. # noqa: E501 + + :param format_in: The format_in of this ElevationPointBody. # noqa: E501 + :type: str + """ + if format_in is None: + raise ValueError("Invalid value for `format_in`, must not be `None`") # noqa: E501 + allowed_values = ["geojson", "point"] # noqa: E501 + if format_in not in allowed_values: + raise ValueError( + "Invalid value for `format_in` ({0}), must be one of {1}" # noqa: E501 + .format(format_in, allowed_values) + ) + + self._format_in = format_in + + @property + def format_out(self): + """Gets the format_out of this ElevationPointBody. # noqa: E501 + + The output format to be returned. # noqa: E501 + + :return: The format_out of this ElevationPointBody. # noqa: E501 + :rtype: str + """ + return self._format_out + + @format_out.setter + def format_out(self, format_out): + """Sets the format_out of this ElevationPointBody. + + The output format to be returned. # noqa: E501 + + :param format_out: The format_out of this ElevationPointBody. # noqa: E501 + :type: str + """ + allowed_values = ["geojson", "point"] # noqa: E501 + if format_out not in allowed_values: + raise ValueError( + "Invalid value for `format_out` ({0}), must be one of {1}" # noqa: E501 + .format(format_out, allowed_values) + ) + + self._format_out = format_out + + @property + def geometry(self): + """Gets the geometry of this ElevationPointBody. # noqa: E501 + + * geojson: A geometry object of a Point GeoJSON, e.g. {\"type\": \"Point\", \"coordinates\": [13.331273, 38.10849] } * point: A coordinate list, e.g. [13.331273, 38.10849] # noqa: E501 + + :return: The geometry of this ElevationPointBody. # noqa: E501 + :rtype: object + """ + return self._geometry + + @geometry.setter + def geometry(self, geometry): + """Sets the geometry of this ElevationPointBody. + + * geojson: A geometry object of a Point GeoJSON, e.g. {\"type\": \"Point\", \"coordinates\": [13.331273, 38.10849] } * point: A coordinate list, e.g. [13.331273, 38.10849] # noqa: E501 + + :param geometry: The geometry of this ElevationPointBody. # noqa: E501 + :type: object + """ + if geometry is None: + raise ValueError("Invalid value for `geometry`, must not be `None`") # noqa: E501 + + self._geometry = geometry + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ElevationPointBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ElevationPointBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/isochrones_profile_body.py b/openrouteservice/models/isochrones_profile_body.py new file mode 100644 index 00000000..b1e03aec --- /dev/null +++ b/openrouteservice/models/isochrones_profile_body.py @@ -0,0 +1,451 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class IsochronesProfileBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'area_units': 'str', + 'attributes': 'list[str]', + 'id': 'str', + 'intersections': 'bool', + 'interval': 'float', + 'location_type': 'str', + 'locations': 'list[list[float]]', + 'options': 'RouteOptions', + 'range': 'list[float]', + 'range_type': 'str', + 'smoothing': 'float', + 'units': 'str' + } + + attribute_map = { + 'area_units': 'area_units', + 'attributes': 'attributes', + 'id': 'id', + 'intersections': 'intersections', + 'interval': 'interval', + 'location_type': 'location_type', + 'locations': 'locations', + 'options': 'options', + 'range': 'range', + 'range_type': 'range_type', + 'smoothing': 'smoothing', + 'units': 'units' + } + + def __init__(self, area_units='m', attributes=None, id=None, intersections=False, interval=None, location_type='start', locations=None, options=None, range=None, range_type='time', smoothing=None, units='m'): # noqa: E501 + """IsochronesProfileBody - a model defined in Swagger""" # noqa: E501 + self._area_units = None + self._attributes = None + self._id = None + self._intersections = None + self._interval = None + self._location_type = None + self._locations = None + self._options = None + self._range = None + self._range_type = None + self._smoothing = None + self._units = None + self.discriminator = None + if area_units is not None: + self.area_units = area_units + if attributes is not None: + self.attributes = attributes + if id is not None: + self.id = id + if intersections is not None: + self.intersections = intersections + if interval is not None: + self.interval = interval + if location_type is not None: + self.location_type = location_type + self.locations = locations + if options is not None: + self.options = options + self.range = range + if range_type is not None: + self.range_type = range_type + if smoothing is not None: + self.smoothing = smoothing + if units is not None: + self.units = units + + @property + def area_units(self): + """Gets the area_units of this IsochronesProfileBody. # noqa: E501 + + Specifies the area unit. Default: m. # noqa: E501 + + :return: The area_units of this IsochronesProfileBody. # noqa: E501 + :rtype: str + """ + return self._area_units + + @area_units.setter + def area_units(self, area_units): + """Sets the area_units of this IsochronesProfileBody. + + Specifies the area unit. Default: m. # noqa: E501 + + :param area_units: The area_units of this IsochronesProfileBody. # noqa: E501 + :type: str + """ + allowed_values = ["m", "km", "mi"] # noqa: E501 + if area_units not in allowed_values: + raise ValueError( + "Invalid value for `area_units` ({0}), must be one of {1}" # noqa: E501 + .format(area_units, allowed_values) + ) + + self._area_units = area_units + + @property + def attributes(self): + """Gets the attributes of this IsochronesProfileBody. # noqa: E501 + + List of isochrones attributes # noqa: E501 + + :return: The attributes of this IsochronesProfileBody. # noqa: E501 + :rtype: list[str] + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this IsochronesProfileBody. + + List of isochrones attributes # noqa: E501 + + :param attributes: The attributes of this IsochronesProfileBody. # noqa: E501 + :type: list[str] + """ + allowed_values = ["area", "reachfactor", "total_pop"] # noqa: E501 + if not set(attributes).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `attributes` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(attributes) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._attributes = attributes + + @property + def id(self): + """Gets the id of this IsochronesProfileBody. # noqa: E501 + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :return: The id of this IsochronesProfileBody. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this IsochronesProfileBody. + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :param id: The id of this IsochronesProfileBody. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def intersections(self): + """Gets the intersections of this IsochronesProfileBody. # noqa: E501 + + Specifies whether to return intersecting polygons. # noqa: E501 + + :return: The intersections of this IsochronesProfileBody. # noqa: E501 + :rtype: bool + """ + return self._intersections + + @intersections.setter + def intersections(self, intersections): + """Sets the intersections of this IsochronesProfileBody. + + Specifies whether to return intersecting polygons. # noqa: E501 + + :param intersections: The intersections of this IsochronesProfileBody. # noqa: E501 + :type: bool + """ + + self._intersections = intersections + + @property + def interval(self): + """Gets the interval of this IsochronesProfileBody. # noqa: E501 + + Interval of isochrones or equidistants. This is only used if a single range value is given. Value in **seconds** for time and **meters** for distance. # noqa: E501 + + :return: The interval of this IsochronesProfileBody. # noqa: E501 + :rtype: float + """ + return self._interval + + @interval.setter + def interval(self, interval): + """Sets the interval of this IsochronesProfileBody. + + Interval of isochrones or equidistants. This is only used if a single range value is given. Value in **seconds** for time and **meters** for distance. # noqa: E501 + + :param interval: The interval of this IsochronesProfileBody. # noqa: E501 + :type: float + """ + + self._interval = interval + + @property + def location_type(self): + """Gets the location_type of this IsochronesProfileBody. # noqa: E501 + + `start` treats the location(s) as starting point, `destination` as goal. # noqa: E501 + + :return: The location_type of this IsochronesProfileBody. # noqa: E501 + :rtype: str + """ + return self._location_type + + @location_type.setter + def location_type(self, location_type): + """Sets the location_type of this IsochronesProfileBody. + + `start` treats the location(s) as starting point, `destination` as goal. # noqa: E501 + + :param location_type: The location_type of this IsochronesProfileBody. # noqa: E501 + :type: str + """ + allowed_values = ["start", "destination"] # noqa: E501 + if location_type not in allowed_values: + raise ValueError( + "Invalid value for `location_type` ({0}), must be one of {1}" # noqa: E501 + .format(location_type, allowed_values) + ) + + self._location_type = location_type + + @property + def locations(self): + """Gets the locations of this IsochronesProfileBody. # noqa: E501 + + The locations to use for the route as an array of `longitude/latitude` pairs in WGS 84 (EPSG:4326) # noqa: E501 + + :return: The locations of this IsochronesProfileBody. # noqa: E501 + :rtype: list[list[float]] + """ + return self._locations + + @locations.setter + def locations(self, locations): + """Sets the locations of this IsochronesProfileBody. + + The locations to use for the route as an array of `longitude/latitude` pairs in WGS 84 (EPSG:4326) # noqa: E501 + + :param locations: The locations of this IsochronesProfileBody. # noqa: E501 + :type: list[list[float]] + """ + if locations is None: + raise ValueError("Invalid value for `locations`, must not be `None`") # noqa: E501 + + self._locations = locations + + @property + def options(self): + """Gets the options of this IsochronesProfileBody. # noqa: E501 + + + :return: The options of this IsochronesProfileBody. # noqa: E501 + :rtype: RouteOptions + """ + return self._options + + @options.setter + def options(self, options): + """Sets the options of this IsochronesProfileBody. + + + :param options: The options of this IsochronesProfileBody. # noqa: E501 + :type: RouteOptions + """ + + self._options = options + + @property + def range(self): + """Gets the range of this IsochronesProfileBody. # noqa: E501 + + Maximum range value of the analysis in **seconds** for time and **metres** for distance.Alternatively a comma separated list of specific range values. Ranges will be the same for all locations. # noqa: E501 + + :return: The range of this IsochronesProfileBody. # noqa: E501 + :rtype: list[float] + """ + return self._range + + @range.setter + def range(self, range): + """Sets the range of this IsochronesProfileBody. + + Maximum range value of the analysis in **seconds** for time and **metres** for distance.Alternatively a comma separated list of specific range values. Ranges will be the same for all locations. # noqa: E501 + + :param range: The range of this IsochronesProfileBody. # noqa: E501 + :type: list[float] + """ + if range is None: + raise ValueError("Invalid value for `range`, must not be `None`") # noqa: E501 + + self._range = range + + @property + def range_type(self): + """Gets the range_type of this IsochronesProfileBody. # noqa: E501 + + Specifies the isochrones reachability type. # noqa: E501 + + :return: The range_type of this IsochronesProfileBody. # noqa: E501 + :rtype: str + """ + return self._range_type + + @range_type.setter + def range_type(self, range_type): + """Sets the range_type of this IsochronesProfileBody. + + Specifies the isochrones reachability type. # noqa: E501 + + :param range_type: The range_type of this IsochronesProfileBody. # noqa: E501 + :type: str + """ + allowed_values = ["time", "distance"] # noqa: E501 + if range_type not in allowed_values: + raise ValueError( + "Invalid value for `range_type` ({0}), must be one of {1}" # noqa: E501 + .format(range_type, allowed_values) + ) + + self._range_type = range_type + + @property + def smoothing(self): + """Gets the smoothing of this IsochronesProfileBody. # noqa: E501 + + Applies a level of generalisation to the isochrone polygons generated as a `smoothing_factor` between `0` and `100.0`. Generalisation is produced by determining a maximum length of a connecting line between two points found on the outside of a containing polygon. If the distance is larger than a threshold value, the line between the two points is removed and a smaller connecting line between other points is used. Note that the minimum length of this connecting line is ~1333m, and so when the `smoothing_factor` results in a distance smaller than this, the minimum value is used. The threshold value is determined as `(maximum_radius_of_isochrone / 100) * smoothing_factor`. Therefore, a value closer to 100 will result in a more generalised shape. The polygon generation algorithm is based on Duckham and al. (2008) `\"Efficient generation of simple polygons for characterizing the shape of a set of points in the plane.\"` # noqa: E501 + + :return: The smoothing of this IsochronesProfileBody. # noqa: E501 + :rtype: float + """ + return self._smoothing + + @smoothing.setter + def smoothing(self, smoothing): + """Sets the smoothing of this IsochronesProfileBody. + + Applies a level of generalisation to the isochrone polygons generated as a `smoothing_factor` between `0` and `100.0`. Generalisation is produced by determining a maximum length of a connecting line between two points found on the outside of a containing polygon. If the distance is larger than a threshold value, the line between the two points is removed and a smaller connecting line between other points is used. Note that the minimum length of this connecting line is ~1333m, and so when the `smoothing_factor` results in a distance smaller than this, the minimum value is used. The threshold value is determined as `(maximum_radius_of_isochrone / 100) * smoothing_factor`. Therefore, a value closer to 100 will result in a more generalised shape. The polygon generation algorithm is based on Duckham and al. (2008) `\"Efficient generation of simple polygons for characterizing the shape of a set of points in the plane.\"` # noqa: E501 + + :param smoothing: The smoothing of this IsochronesProfileBody. # noqa: E501 + :type: float + """ + + self._smoothing = smoothing + + @property + def units(self): + """Gets the units of this IsochronesProfileBody. # noqa: E501 + + Specifies the distance units only if `range_type` is set to distance. Default: m. # noqa: E501 + + :return: The units of this IsochronesProfileBody. # noqa: E501 + :rtype: str + """ + return self._units + + @units.setter + def units(self, units): + """Sets the units of this IsochronesProfileBody. + + Specifies the distance units only if `range_type` is set to distance. Default: m. # noqa: E501 + + :param units: The units of this IsochronesProfileBody. # noqa: E501 + :type: str + """ + allowed_values = ["m", "km", "mi"] # noqa: E501 + if units not in allowed_values: + raise ValueError( + "Invalid value for `units` ({0}), must be one of {1}" # noqa: E501 + .format(units, allowed_values) + ) + + self._units = units + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(IsochronesProfileBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, IsochronesProfileBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/json_response.py b/openrouteservice/models/json_response.py new file mode 100644 index 00000000..4e0f8e9a --- /dev/null +++ b/openrouteservice/models/json_response.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class JSONResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """JSONResponse - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JSONResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JSONResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/matrix_profile_body.py b/openrouteservice/models/matrix_profile_body.py new file mode 100644 index 00000000..781ccc7f --- /dev/null +++ b/openrouteservice/models/matrix_profile_body.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class MatrixProfileBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'destinations': 'list[str]', + 'id': 'str', + 'locations': 'list[list[float]]', + 'metrics': 'list[str]', + 'resolve_locations': 'bool', + 'sources': 'list[str]', + 'units': 'str' + } + + attribute_map = { + 'destinations': 'destinations', + 'id': 'id', + 'locations': 'locations', + 'metrics': 'metrics', + 'resolve_locations': 'resolve_locations', + 'sources': 'sources', + 'units': 'units' + } + + def __init__(self, destinations=None, id=None, locations=None, metrics=None, resolve_locations=False, sources=None, units='m'): # noqa: E501 + """MatrixProfileBody - a model defined in Swagger""" # noqa: E501 + self._destinations = None + self._id = None + self._locations = None + self._metrics = None + self._resolve_locations = None + self._sources = None + self._units = None + self.discriminator = None + if destinations is not None: + self.destinations = destinations + if id is not None: + self.id = id + self.locations = locations + if metrics is not None: + self.metrics = metrics + if resolve_locations is not None: + self.resolve_locations = resolve_locations + if sources is not None: + self.sources = sources + if units is not None: + self.units = units + + @property + def destinations(self): + """Gets the destinations of this MatrixProfileBody. # noqa: E501 + + A list of indices that refers to the list of locations (starting with `0`). `{index_1},{index_2}[,{index_N} ...]` or `all` (default). `[0,3]` for the first and fourth locations # noqa: E501 + + :return: The destinations of this MatrixProfileBody. # noqa: E501 + :rtype: list[str] + """ + return self._destinations + + @destinations.setter + def destinations(self, destinations): + """Sets the destinations of this MatrixProfileBody. + + A list of indices that refers to the list of locations (starting with `0`). `{index_1},{index_2}[,{index_N} ...]` or `all` (default). `[0,3]` for the first and fourth locations # noqa: E501 + + :param destinations: The destinations of this MatrixProfileBody. # noqa: E501 + :type: list[str] + """ + + self._destinations = destinations + + @property + def id(self): + """Gets the id of this MatrixProfileBody. # noqa: E501 + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :return: The id of this MatrixProfileBody. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this MatrixProfileBody. + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :param id: The id of this MatrixProfileBody. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def locations(self): + """Gets the locations of this MatrixProfileBody. # noqa: E501 + + List of comma separated lists of `longitude,latitude` coordinates in WGS 84 (EPSG:4326) # noqa: E501 + + :return: The locations of this MatrixProfileBody. # noqa: E501 + :rtype: list[list[float]] + """ + return self._locations + + @locations.setter + def locations(self, locations): + """Sets the locations of this MatrixProfileBody. + + List of comma separated lists of `longitude,latitude` coordinates in WGS 84 (EPSG:4326) # noqa: E501 + + :param locations: The locations of this MatrixProfileBody. # noqa: E501 + :type: list[list[float]] + """ + if locations is None: + raise ValueError("Invalid value for `locations`, must not be `None`") # noqa: E501 + + self._locations = locations + + @property + def metrics(self): + """Gets the metrics of this MatrixProfileBody. # noqa: E501 + + Specifies a list of returned metrics. \"* `distance` - Returns distance matrix for specified points in defined `units`. * `duration` - Returns duration matrix for specified points in **seconds**. # noqa: E501 + + :return: The metrics of this MatrixProfileBody. # noqa: E501 + :rtype: list[str] + """ + return self._metrics + + @metrics.setter + def metrics(self, metrics): + """Sets the metrics of this MatrixProfileBody. + + Specifies a list of returned metrics. \"* `distance` - Returns distance matrix for specified points in defined `units`. * `duration` - Returns duration matrix for specified points in **seconds**. # noqa: E501 + + :param metrics: The metrics of this MatrixProfileBody. # noqa: E501 + :type: list[str] + """ + allowed_values = ["distance", "duration"] # noqa: E501 + if not set(metrics).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `metrics` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(metrics) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._metrics = metrics + + @property + def resolve_locations(self): + """Gets the resolve_locations of this MatrixProfileBody. # noqa: E501 + + Specifies whether given locations are resolved or not. If the parameter value set to `true`, every element in `destinations` and `sources` will contain a `name` element that identifies the name of the closest street. Default is `false`. # noqa: E501 + + :return: The resolve_locations of this MatrixProfileBody. # noqa: E501 + :rtype: bool + """ + return self._resolve_locations + + @resolve_locations.setter + def resolve_locations(self, resolve_locations): + """Sets the resolve_locations of this MatrixProfileBody. + + Specifies whether given locations are resolved or not. If the parameter value set to `true`, every element in `destinations` and `sources` will contain a `name` element that identifies the name of the closest street. Default is `false`. # noqa: E501 + + :param resolve_locations: The resolve_locations of this MatrixProfileBody. # noqa: E501 + :type: bool + """ + + self._resolve_locations = resolve_locations + + @property + def sources(self): + """Gets the sources of this MatrixProfileBody. # noqa: E501 + + A list of indices that refers to the list of locations (starting with `0`). `{index_1},{index_2}[,{index_N} ...]` or `all` (default). example `[0,3]` for the first and fourth locations # noqa: E501 + + :return: The sources of this MatrixProfileBody. # noqa: E501 + :rtype: list[str] + """ + return self._sources + + @sources.setter + def sources(self, sources): + """Sets the sources of this MatrixProfileBody. + + A list of indices that refers to the list of locations (starting with `0`). `{index_1},{index_2}[,{index_N} ...]` or `all` (default). example `[0,3]` for the first and fourth locations # noqa: E501 + + :param sources: The sources of this MatrixProfileBody. # noqa: E501 + :type: list[str] + """ + + self._sources = sources + + @property + def units(self): + """Gets the units of this MatrixProfileBody. # noqa: E501 + + Specifies the distance unit. Default: m. # noqa: E501 + + :return: The units of this MatrixProfileBody. # noqa: E501 + :rtype: str + """ + return self._units + + @units.setter + def units(self, units): + """Sets the units of this MatrixProfileBody. + + Specifies the distance unit. Default: m. # noqa: E501 + + :param units: The units of this MatrixProfileBody. # noqa: E501 + :type: str + """ + allowed_values = ["m", "km", "mi"] # noqa: E501 + if units not in allowed_values: + raise ValueError( + "Invalid value for `units` ({0}), must be one of {1}" # noqa: E501 + .format(units, allowed_values) + ) + + self._units = units + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MatrixProfileBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MatrixProfileBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/openpoiservice_poi_request.py b/openrouteservice/models/openpoiservice_poi_request.py new file mode 100644 index 00000000..77b752bc --- /dev/null +++ b/openrouteservice/models/openpoiservice_poi_request.py @@ -0,0 +1,234 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OpenpoiservicePoiRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'filters': 'PoisFilters', + 'geometry': 'PoisGeometry', + 'limit': 'int', + 'request': 'str', + 'sortby': 'str' + } + + attribute_map = { + 'filters': 'filters', + 'geometry': 'geometry', + 'limit': 'limit', + 'request': 'request', + 'sortby': 'sortby' + } + + def __init__(self, filters=None, geometry=None, limit=None, request=None, sortby=None): # noqa: E501 + """OpenpoiservicePoiRequest - a model defined in Swagger""" # noqa: E501 + self._filters = None + self._geometry = None + self._limit = None + self._request = None + self._sortby = None + self.discriminator = None + if filters is not None: + self.filters = filters + self.geometry = geometry + if limit is not None: + self.limit = limit + self.request = request + if sortby is not None: + self.sortby = sortby + + @property + def filters(self): + """Gets the filters of this OpenpoiservicePoiRequest. # noqa: E501 + + + :return: The filters of this OpenpoiservicePoiRequest. # noqa: E501 + :rtype: PoisFilters + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this OpenpoiservicePoiRequest. + + + :param filters: The filters of this OpenpoiservicePoiRequest. # noqa: E501 + :type: PoisFilters + """ + + self._filters = filters + + @property + def geometry(self): + """Gets the geometry of this OpenpoiservicePoiRequest. # noqa: E501 + + + :return: The geometry of this OpenpoiservicePoiRequest. # noqa: E501 + :rtype: PoisGeometry + """ + return self._geometry + + @geometry.setter + def geometry(self, geometry): + """Sets the geometry of this OpenpoiservicePoiRequest. + + + :param geometry: The geometry of this OpenpoiservicePoiRequest. # noqa: E501 + :type: PoisGeometry + """ + if geometry is None: + raise ValueError("Invalid value for `geometry`, must not be `None`") # noqa: E501 + + self._geometry = geometry + + @property + def limit(self): + """Gets the limit of this OpenpoiservicePoiRequest. # noqa: E501 + + The limit of objects to be returned in the response. # noqa: E501 + + :return: The limit of this OpenpoiservicePoiRequest. # noqa: E501 + :rtype: int + """ + return self._limit + + @limit.setter + def limit(self, limit): + """Sets the limit of this OpenpoiservicePoiRequest. + + The limit of objects to be returned in the response. # noqa: E501 + + :param limit: The limit of this OpenpoiservicePoiRequest. # noqa: E501 + :type: int + """ + + self._limit = limit + + @property + def request(self): + """Gets the request of this OpenpoiservicePoiRequest. # noqa: E501 + + Examples: ``` #### JSON bodies for POST requests ##### Pois around a buffered point { \"request\": \"pois\", \"geometry\": { \"bbox\": [ [8.8034, 53.0756], [8.7834, 53.0456] ], \"geojson\": { \"type\": \"Point\", \"coordinates\": [8.8034, 53.0756] }, \"buffer\": 250 } } ##### Pois given categories { \"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 given category groups { \"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] } } ##### Pois statistics { \"request\": \"stats\", \"geometry\": { \"bbox\": [ [8.8034, 53.0756], [8.7834, 53.0456] ], \"geojson\": { \"type\": \"Point\", \"coordinates\": [8.8034, 53.0756] }, \"buffer\": 100 } } ##### Pois categories as a list { \"request\": \"list\" } ``` # noqa: E501 + + :return: The request of this OpenpoiservicePoiRequest. # noqa: E501 + :rtype: str + """ + return self._request + + @request.setter + def request(self, request): + """Sets the request of this OpenpoiservicePoiRequest. + + Examples: ``` #### JSON bodies for POST requests ##### Pois around a buffered point { \"request\": \"pois\", \"geometry\": { \"bbox\": [ [8.8034, 53.0756], [8.7834, 53.0456] ], \"geojson\": { \"type\": \"Point\", \"coordinates\": [8.8034, 53.0756] }, \"buffer\": 250 } } ##### Pois given categories { \"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 given category groups { \"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] } } ##### Pois statistics { \"request\": \"stats\", \"geometry\": { \"bbox\": [ [8.8034, 53.0756], [8.7834, 53.0456] ], \"geojson\": { \"type\": \"Point\", \"coordinates\": [8.8034, 53.0756] }, \"buffer\": 100 } } ##### Pois categories as a list { \"request\": \"list\" } ``` # noqa: E501 + + :param request: The request of this OpenpoiservicePoiRequest. # noqa: E501 + :type: str + """ + if request is None: + raise ValueError("Invalid value for `request`, must not be `None`") # noqa: E501 + allowed_values = ["pois", "stats", "list"] # noqa: E501 + if request not in allowed_values: + raise ValueError( + "Invalid value for `request` ({0}), must be one of {1}" # noqa: E501 + .format(request, allowed_values) + ) + + self._request = request + + @property + def sortby(self): + """Gets the sortby of this OpenpoiservicePoiRequest. # noqa: E501 + + Either you can sort by category or the distance to the geometry object provided in the request. # noqa: E501 + + :return: The sortby of this OpenpoiservicePoiRequest. # noqa: E501 + :rtype: str + """ + return self._sortby + + @sortby.setter + def sortby(self, sortby): + """Sets the sortby of this OpenpoiservicePoiRequest. + + Either you can sort by category or the distance to the geometry object provided in the request. # noqa: E501 + + :param sortby: The sortby of this OpenpoiservicePoiRequest. # noqa: E501 + :type: str + """ + allowed_values = ["category", "distance"] # noqa: E501 + if sortby not in allowed_values: + raise ValueError( + "Invalid value for `sortby` ({0}), must be one of {1}" # noqa: E501 + .format(sortby, allowed_values) + ) + + self._sortby = sortby + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OpenpoiservicePoiRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OpenpoiservicePoiRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_body.py b/openrouteservice/models/optimization_body.py new file mode 100644 index 00000000..d2d04894 --- /dev/null +++ b/openrouteservice/models/optimization_body.py @@ -0,0 +1,194 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'jobs': 'list[OptimizationJobs]', + 'matrices': 'OptimizationMatrices', + 'options': 'OptimizationOptions', + 'vehicles': 'list[OptimizationVehicles]' + } + + attribute_map = { + 'jobs': 'jobs', + 'matrices': 'matrices', + 'options': 'options', + 'vehicles': 'vehicles' + } + + def __init__(self, jobs=None, matrices=None, options=None, vehicles=None): # noqa: E501 + """OptimizationBody - a model defined in Swagger""" # noqa: E501 + self._jobs = None + self._matrices = None + self._options = None + self._vehicles = None + self.discriminator = None + self.jobs = jobs + if matrices is not None: + self.matrices = matrices + if options is not None: + self.options = options + self.vehicles = vehicles + + @property + def jobs(self): + """Gets the jobs of this OptimizationBody. # noqa: E501 + + Array of `job` objects describing the places to visit. For a detailed object description visit the [VROOM api description](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md#jobs) # noqa: E501 + + :return: The jobs of this OptimizationBody. # noqa: E501 + :rtype: list[OptimizationJobs] + """ + return self._jobs + + @jobs.setter + def jobs(self, jobs): + """Sets the jobs of this OptimizationBody. + + Array of `job` objects describing the places to visit. For a detailed object description visit the [VROOM api description](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md#jobs) # noqa: E501 + + :param jobs: The jobs of this OptimizationBody. # noqa: E501 + :type: list[OptimizationJobs] + """ + if jobs is None: + raise ValueError("Invalid value for `jobs`, must not be `None`") # noqa: E501 + + self._jobs = jobs + + @property + def matrices(self): + """Gets the matrices of this OptimizationBody. # noqa: E501 + + + :return: The matrices of this OptimizationBody. # noqa: E501 + :rtype: OptimizationMatrices + """ + return self._matrices + + @matrices.setter + def matrices(self, matrices): + """Sets the matrices of this OptimizationBody. + + + :param matrices: The matrices of this OptimizationBody. # noqa: E501 + :type: OptimizationMatrices + """ + + self._matrices = matrices + + @property + def options(self): + """Gets the options of this OptimizationBody. # noqa: E501 + + + :return: The options of this OptimizationBody. # noqa: E501 + :rtype: OptimizationOptions + """ + return self._options + + @options.setter + def options(self, options): + """Sets the options of this OptimizationBody. + + + :param options: The options of this OptimizationBody. # noqa: E501 + :type: OptimizationOptions + """ + + self._options = options + + @property + def vehicles(self): + """Gets the vehicles of this OptimizationBody. # noqa: E501 + + Array of `vehicle` objects describing the available vehicles. For a detailed object description visit the [VROOM API description](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md#vehicles) # noqa: E501 + + :return: The vehicles of this OptimizationBody. # noqa: E501 + :rtype: list[OptimizationVehicles] + """ + return self._vehicles + + @vehicles.setter + def vehicles(self, vehicles): + """Sets the vehicles of this OptimizationBody. + + Array of `vehicle` objects describing the available vehicles. For a detailed object description visit the [VROOM API description](https://github.com/VROOM-Project/vroom/blob/master/docs/API.md#vehicles) # noqa: E501 + + :param vehicles: The vehicles of this OptimizationBody. # noqa: E501 + :type: list[OptimizationVehicles] + """ + if vehicles is None: + raise ValueError("Invalid value for `vehicles`, must not be `None`") # noqa: E501 + + self._vehicles = vehicles + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_breaks.py b/openrouteservice/models/optimization_breaks.py new file mode 100644 index 00000000..d648685e --- /dev/null +++ b/openrouteservice/models/optimization_breaks.py @@ -0,0 +1,224 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationBreaks(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'id': 'int', + 'max_load': 'list[float]', + 'service': 'float', + 'time_windows': 'list[list[int]]' + } + + attribute_map = { + 'description': 'description', + 'id': 'id', + 'max_load': 'max_load', + 'service': 'service', + 'time_windows': 'time_windows' + } + + def __init__(self, description=None, id=None, max_load=None, service=0, time_windows=None): # noqa: E501 + """OptimizationBreaks - a model defined in Swagger""" # noqa: E501 + self._description = None + self._id = None + self._max_load = None + self._service = None + self._time_windows = None + self.discriminator = None + if description is not None: + self.description = description + if id is not None: + self.id = id + if max_load is not None: + self.max_load = max_load + if service is not None: + self.service = service + if time_windows is not None: + self.time_windows = time_windows + + @property + def description(self): + """Gets the description of this OptimizationBreaks. # noqa: E501 + + a string describing this break # noqa: E501 + + :return: The description of this OptimizationBreaks. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this OptimizationBreaks. + + a string describing this break # noqa: E501 + + :param description: The description of this OptimizationBreaks. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def id(self): + """Gets the id of this OptimizationBreaks. # noqa: E501 + + Integer used as unique identifier # noqa: E501 + + :return: The id of this OptimizationBreaks. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OptimizationBreaks. + + Integer used as unique identifier # noqa: E501 + + :param id: The id of this OptimizationBreaks. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def max_load(self): + """Gets the max_load of this OptimizationBreaks. # noqa: E501 + + Array of integers describing the maximum vehicle load for which this break can happen. An error is reported if two break objects have the same id for the same vehicle. # noqa: E501 + + :return: The max_load of this OptimizationBreaks. # noqa: E501 + :rtype: list[float] + """ + return self._max_load + + @max_load.setter + def max_load(self, max_load): + """Sets the max_load of this OptimizationBreaks. + + Array of integers describing the maximum vehicle load for which this break can happen. An error is reported if two break objects have the same id for the same vehicle. # noqa: E501 + + :param max_load: The max_load of this OptimizationBreaks. # noqa: E501 + :type: list[float] + """ + + self._max_load = max_load + + @property + def service(self): + """Gets the service of this OptimizationBreaks. # noqa: E501 + + break duration in seconds (defaults to 0) # noqa: E501 + + :return: The service of this OptimizationBreaks. # noqa: E501 + :rtype: float + """ + return self._service + + @service.setter + def service(self, service): + """Sets the service of this OptimizationBreaks. + + break duration in seconds (defaults to 0) # noqa: E501 + + :param service: The service of this OptimizationBreaks. # noqa: E501 + :type: float + """ + + self._service = service + + @property + def time_windows(self): + """Gets the time_windows of this OptimizationBreaks. # noqa: E501 + + Array of time_window objects describing valid slots for break start and end, in week seconds, i.e. 28800 = Mon, 8 AM. # noqa: E501 + + :return: The time_windows of this OptimizationBreaks. # noqa: E501 + :rtype: list[list[int]] + """ + return self._time_windows + + @time_windows.setter + def time_windows(self, time_windows): + """Sets the time_windows of this OptimizationBreaks. + + Array of time_window objects describing valid slots for break start and end, in week seconds, i.e. 28800 = Mon, 8 AM. # noqa: E501 + + :param time_windows: The time_windows of this OptimizationBreaks. # noqa: E501 + :type: list[list[int]] + """ + + self._time_windows = time_windows + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationBreaks, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationBreaks): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_costs.py b/openrouteservice/models/optimization_costs.py new file mode 100644 index 00000000..113f5f27 --- /dev/null +++ b/openrouteservice/models/optimization_costs.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationCosts(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'fixed': 'float', + 'per_hour': 'float', + 'per_km': 'float' + } + + attribute_map = { + 'fixed': 'fixed', + 'per_hour': 'per_hour', + 'per_km': 'per_km' + } + + def __init__(self, fixed=0, per_hour=3600, per_km=0): # noqa: E501 + """OptimizationCosts - a model defined in Swagger""" # noqa: E501 + self._fixed = None + self._per_hour = None + self._per_km = None + self.discriminator = None + if fixed is not None: + self.fixed = fixed + if per_hour is not None: + self.per_hour = per_hour + if per_km is not None: + self.per_km = per_km + + @property + def fixed(self): + """Gets the fixed of this OptimizationCosts. # noqa: E501 + + integer defining the cost of using this vehicle in the solution (defaults to 0) # noqa: E501 + + :return: The fixed of this OptimizationCosts. # noqa: E501 + :rtype: float + """ + return self._fixed + + @fixed.setter + def fixed(self, fixed): + """Sets the fixed of this OptimizationCosts. + + integer defining the cost of using this vehicle in the solution (defaults to 0) # noqa: E501 + + :param fixed: The fixed of this OptimizationCosts. # noqa: E501 + :type: float + """ + + self._fixed = fixed + + @property + def per_hour(self): + """Gets the per_hour of this OptimizationCosts. # noqa: E501 + + integer defining the cost for one hour of travel time with this vehicle (defaults to 3600) # noqa: E501 + + :return: The per_hour of this OptimizationCosts. # noqa: E501 + :rtype: float + """ + return self._per_hour + + @per_hour.setter + def per_hour(self, per_hour): + """Sets the per_hour of this OptimizationCosts. + + integer defining the cost for one hour of travel time with this vehicle (defaults to 3600) # noqa: E501 + + :param per_hour: The per_hour of this OptimizationCosts. # noqa: E501 + :type: float + """ + + self._per_hour = per_hour + + @property + def per_km(self): + """Gets the per_km of this OptimizationCosts. # noqa: E501 + + integer defining the cost for one km of travel time with this vehicle (defaults to 0) # noqa: E501 + + :return: The per_km of this OptimizationCosts. # noqa: E501 + :rtype: float + """ + return self._per_km + + @per_km.setter + def per_km(self, per_km): + """Sets the per_km of this OptimizationCosts. + + integer defining the cost for one km of travel time with this vehicle (defaults to 0) # noqa: E501 + + :param per_km: The per_km of this OptimizationCosts. # noqa: E501 + :type: float + """ + + self._per_km = per_km + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationCosts, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationCosts): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_jobs.py b/openrouteservice/models/optimization_jobs.py new file mode 100644 index 00000000..2d1ed562 --- /dev/null +++ b/openrouteservice/models/optimization_jobs.py @@ -0,0 +1,392 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationJobs(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'delivery': 'list[float]', + 'description': 'str', + 'id': 'int', + 'location': 'list[list[float]]', + 'location_index': 'object', + 'pickup': 'list[float]', + 'priority': 'float', + 'service': 'object', + 'setup': 'float', + 'skills': 'list[int]', + 'time_windows': 'list[list[int]]' + } + + attribute_map = { + 'delivery': 'delivery', + 'description': 'description', + 'id': 'id', + 'location': 'location', + 'location_index': 'location_index', + 'pickup': 'pickup', + 'priority': 'priority', + 'service': 'service', + 'setup': 'setup', + 'skills': 'skills', + 'time_windows': 'time_windows' + } + + def __init__(self, delivery=None, description=None, id=None, location=None, location_index=None, pickup=None, priority=0, service=None, setup=None, skills=None, time_windows=None): # noqa: E501 + """OptimizationJobs - a model defined in Swagger""" # noqa: E501 + self._delivery = None + self._description = None + self._id = None + self._location = None + self._location_index = None + self._pickup = None + self._priority = None + self._service = None + self._setup = None + self._skills = None + self._time_windows = None + self.discriminator = None + if delivery is not None: + self.delivery = delivery + if description is not None: + self.description = description + if id is not None: + self.id = id + if location is not None: + self.location = location + if location_index is not None: + self.location_index = location_index + if pickup is not None: + self.pickup = pickup + if priority is not None: + self.priority = priority + if service is not None: + self.service = service + if setup is not None: + self.setup = setup + if skills is not None: + self.skills = skills + if time_windows is not None: + self.time_windows = time_windows + + @property + def delivery(self): + """Gets the delivery of this OptimizationJobs. # noqa: E501 + + an array of integers describing multidimensional quantities for delivery # noqa: E501 + + :return: The delivery of this OptimizationJobs. # noqa: E501 + :rtype: list[float] + """ + return self._delivery + + @delivery.setter + def delivery(self, delivery): + """Sets the delivery of this OptimizationJobs. + + an array of integers describing multidimensional quantities for delivery # noqa: E501 + + :param delivery: The delivery of this OptimizationJobs. # noqa: E501 + :type: list[float] + """ + + self._delivery = delivery + + @property + def description(self): + """Gets the description of this OptimizationJobs. # noqa: E501 + + a string describing this job # noqa: E501 + + :return: The description of this OptimizationJobs. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this OptimizationJobs. + + a string describing this job # noqa: E501 + + :param description: The description of this OptimizationJobs. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def id(self): + """Gets the id of this OptimizationJobs. # noqa: E501 + + an integer used as unique identifier # noqa: E501 + + :return: The id of this OptimizationJobs. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OptimizationJobs. + + an integer used as unique identifier # noqa: E501 + + :param id: The id of this OptimizationJobs. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def location(self): + """Gets the location of this OptimizationJobs. # noqa: E501 + + coordinates array in `[lon, lat]` # noqa: E501 + + :return: The location of this OptimizationJobs. # noqa: E501 + :rtype: list[list[float]] + """ + return self._location + + @location.setter + def location(self, location): + """Sets the location of this OptimizationJobs. + + coordinates array in `[lon, lat]` # noqa: E501 + + :param location: The location of this OptimizationJobs. # noqa: E501 + :type: list[list[float]] + """ + + self._location = location + + @property + def location_index(self): + """Gets the location_index of this OptimizationJobs. # noqa: E501 + + index of relevant row and column in custom matrix # noqa: E501 + + :return: The location_index of this OptimizationJobs. # noqa: E501 + :rtype: object + """ + return self._location_index + + @location_index.setter + def location_index(self, location_index): + """Sets the location_index of this OptimizationJobs. + + index of relevant row and column in custom matrix # noqa: E501 + + :param location_index: The location_index of this OptimizationJobs. # noqa: E501 + :type: object + """ + + self._location_index = location_index + + @property + def pickup(self): + """Gets the pickup of this OptimizationJobs. # noqa: E501 + + an array of integers describing multidimensional quantities for pickup # noqa: E501 + + :return: The pickup of this OptimizationJobs. # noqa: E501 + :rtype: list[float] + """ + return self._pickup + + @pickup.setter + def pickup(self, pickup): + """Sets the pickup of this OptimizationJobs. + + an array of integers describing multidimensional quantities for pickup # noqa: E501 + + :param pickup: The pickup of this OptimizationJobs. # noqa: E501 + :type: list[float] + """ + + self._pickup = pickup + + @property + def priority(self): + """Gets the priority of this OptimizationJobs. # noqa: E501 + + an integer in the range [0, 100] describing priority level (defaults to 0) # noqa: E501 + + :return: The priority of this OptimizationJobs. # noqa: E501 + :rtype: float + """ + return self._priority + + @priority.setter + def priority(self, priority): + """Sets the priority of this OptimizationJobs. + + an integer in the range [0, 100] describing priority level (defaults to 0) # noqa: E501 + + :param priority: The priority of this OptimizationJobs. # noqa: E501 + :type: float + """ + + self._priority = priority + + @property + def service(self): + """Gets the service of this OptimizationJobs. # noqa: E501 + + job service duration (defaults to 0), in seconds # noqa: E501 + + :return: The service of this OptimizationJobs. # noqa: E501 + :rtype: object + """ + return self._service + + @service.setter + def service(self, service): + """Sets the service of this OptimizationJobs. + + job service duration (defaults to 0), in seconds # noqa: E501 + + :param service: The service of this OptimizationJobs. # noqa: E501 + :type: object + """ + + self._service = service + + @property + def setup(self): + """Gets the setup of this OptimizationJobs. # noqa: E501 + + job setup duration (defaults to 0), in seconds # noqa: E501 + + :return: The setup of this OptimizationJobs. # noqa: E501 + :rtype: float + """ + return self._setup + + @setup.setter + def setup(self, setup): + """Sets the setup of this OptimizationJobs. + + job setup duration (defaults to 0), in seconds # noqa: E501 + + :param setup: The setup of this OptimizationJobs. # noqa: E501 + :type: float + """ + + self._setup = setup + + @property + def skills(self): + """Gets the skills of this OptimizationJobs. # noqa: E501 + + Array of integers defining mandatory skills for this job # noqa: E501 + + :return: The skills of this OptimizationJobs. # noqa: E501 + :rtype: list[int] + """ + return self._skills + + @skills.setter + def skills(self, skills): + """Sets the skills of this OptimizationJobs. + + Array of integers defining mandatory skills for this job # noqa: E501 + + :param skills: The skills of this OptimizationJobs. # noqa: E501 + :type: list[int] + """ + + self._skills = skills + + @property + def time_windows(self): + """Gets the time_windows of this OptimizationJobs. # noqa: E501 + + Array of `time_window` arrays describing valid slots for job service start and end, in week seconds, i.e. 28800 = Mon, 8 AM. # noqa: E501 + + :return: The time_windows of this OptimizationJobs. # noqa: E501 + :rtype: list[list[int]] + """ + return self._time_windows + + @time_windows.setter + def time_windows(self, time_windows): + """Sets the time_windows of this OptimizationJobs. + + Array of `time_window` arrays describing valid slots for job service start and end, in week seconds, i.e. 28800 = Mon, 8 AM. # noqa: E501 + + :param time_windows: The time_windows of this OptimizationJobs. # noqa: E501 + :type: list[list[int]] + """ + + self._time_windows = time_windows + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationJobs, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationJobs): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_matrices.py b/openrouteservice/models/optimization_matrices.py new file mode 100644 index 00000000..47e06c64 --- /dev/null +++ b/openrouteservice/models/optimization_matrices.py @@ -0,0 +1,318 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationMatrices(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'cycling_electric': 'OptimizationMatricesCyclingelectric', + 'cycling_mountain': 'OptimizationMatricesCyclingelectric', + 'cycling_regular': 'OptimizationMatricesCyclingelectric', + 'cycling_road': 'OptimizationMatricesCyclingelectric', + 'driving_car': 'OptimizationMatricesCyclingelectric', + 'driving_hgv': 'OptimizationMatricesCyclingelectric', + 'foot_hiking': 'OptimizationMatricesCyclingelectric', + 'foot_walking': 'OptimizationMatricesCyclingelectric', + 'wheelchair': 'OptimizationMatricesCyclingelectric' + } + + attribute_map = { + 'cycling_electric': 'cycling-electric', + 'cycling_mountain': 'cycling-mountain', + 'cycling_regular': 'cycling-regular', + 'cycling_road': 'cycling-road', + 'driving_car': 'driving-car', + 'driving_hgv': 'driving-hgv', + 'foot_hiking': 'foot-hiking', + 'foot_walking': 'foot-walking', + 'wheelchair': 'wheelchair' + } + + def __init__(self, cycling_electric=None, cycling_mountain=None, cycling_regular=None, cycling_road=None, driving_car=None, driving_hgv=None, foot_hiking=None, foot_walking=None, wheelchair=None): # noqa: E501 + """OptimizationMatrices - a model defined in Swagger""" # noqa: E501 + self._cycling_electric = None + self._cycling_mountain = None + self._cycling_regular = None + self._cycling_road = None + self._driving_car = None + self._driving_hgv = None + self._foot_hiking = None + self._foot_walking = None + self._wheelchair = None + self.discriminator = None + if cycling_electric is not None: + self.cycling_electric = cycling_electric + if cycling_mountain is not None: + self.cycling_mountain = cycling_mountain + if cycling_regular is not None: + self.cycling_regular = cycling_regular + if cycling_road is not None: + self.cycling_road = cycling_road + if driving_car is not None: + self.driving_car = driving_car + if driving_hgv is not None: + self.driving_hgv = driving_hgv + if foot_hiking is not None: + self.foot_hiking = foot_hiking + if foot_walking is not None: + self.foot_walking = foot_walking + if wheelchair is not None: + self.wheelchair = wheelchair + + @property + def cycling_electric(self): + """Gets the cycling_electric of this OptimizationMatrices. # noqa: E501 + + + :return: The cycling_electric of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._cycling_electric + + @cycling_electric.setter + def cycling_electric(self, cycling_electric): + """Sets the cycling_electric of this OptimizationMatrices. + + + :param cycling_electric: The cycling_electric of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._cycling_electric = cycling_electric + + @property + def cycling_mountain(self): + """Gets the cycling_mountain of this OptimizationMatrices. # noqa: E501 + + + :return: The cycling_mountain of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._cycling_mountain + + @cycling_mountain.setter + def cycling_mountain(self, cycling_mountain): + """Sets the cycling_mountain of this OptimizationMatrices. + + + :param cycling_mountain: The cycling_mountain of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._cycling_mountain = cycling_mountain + + @property + def cycling_regular(self): + """Gets the cycling_regular of this OptimizationMatrices. # noqa: E501 + + + :return: The cycling_regular of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._cycling_regular + + @cycling_regular.setter + def cycling_regular(self, cycling_regular): + """Sets the cycling_regular of this OptimizationMatrices. + + + :param cycling_regular: The cycling_regular of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._cycling_regular = cycling_regular + + @property + def cycling_road(self): + """Gets the cycling_road of this OptimizationMatrices. # noqa: E501 + + + :return: The cycling_road of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._cycling_road + + @cycling_road.setter + def cycling_road(self, cycling_road): + """Sets the cycling_road of this OptimizationMatrices. + + + :param cycling_road: The cycling_road of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._cycling_road = cycling_road + + @property + def driving_car(self): + """Gets the driving_car of this OptimizationMatrices. # noqa: E501 + + + :return: The driving_car of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._driving_car + + @driving_car.setter + def driving_car(self, driving_car): + """Sets the driving_car of this OptimizationMatrices. + + + :param driving_car: The driving_car of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._driving_car = driving_car + + @property + def driving_hgv(self): + """Gets the driving_hgv of this OptimizationMatrices. # noqa: E501 + + + :return: The driving_hgv of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._driving_hgv + + @driving_hgv.setter + def driving_hgv(self, driving_hgv): + """Sets the driving_hgv of this OptimizationMatrices. + + + :param driving_hgv: The driving_hgv of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._driving_hgv = driving_hgv + + @property + def foot_hiking(self): + """Gets the foot_hiking of this OptimizationMatrices. # noqa: E501 + + + :return: The foot_hiking of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._foot_hiking + + @foot_hiking.setter + def foot_hiking(self, foot_hiking): + """Sets the foot_hiking of this OptimizationMatrices. + + + :param foot_hiking: The foot_hiking of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._foot_hiking = foot_hiking + + @property + def foot_walking(self): + """Gets the foot_walking of this OptimizationMatrices. # noqa: E501 + + + :return: The foot_walking of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._foot_walking + + @foot_walking.setter + def foot_walking(self, foot_walking): + """Sets the foot_walking of this OptimizationMatrices. + + + :param foot_walking: The foot_walking of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._foot_walking = foot_walking + + @property + def wheelchair(self): + """Gets the wheelchair of this OptimizationMatrices. # noqa: E501 + + + :return: The wheelchair of this OptimizationMatrices. # noqa: E501 + :rtype: OptimizationMatricesCyclingelectric + """ + return self._wheelchair + + @wheelchair.setter + def wheelchair(self, wheelchair): + """Sets the wheelchair of this OptimizationMatrices. + + + :param wheelchair: The wheelchair of this OptimizationMatrices. # noqa: E501 + :type: OptimizationMatricesCyclingelectric + """ + + self._wheelchair = wheelchair + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationMatrices, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationMatrices): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_matrices_cyclingelectric.py b/openrouteservice/models/optimization_matrices_cyclingelectric.py new file mode 100644 index 00000000..d105ba1e --- /dev/null +++ b/openrouteservice/models/optimization_matrices_cyclingelectric.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationMatricesCyclingelectric(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'costs': 'list[list[int]]', + 'distances': 'list[list[int]]', + 'durations': 'list[list[int]]' + } + + attribute_map = { + 'costs': 'costs', + 'distances': 'distances', + 'durations': 'durations' + } + + def __init__(self, costs=None, distances=None, durations=None): # noqa: E501 + """OptimizationMatricesCyclingelectric - a model defined in Swagger""" # noqa: E501 + self._costs = None + self._distances = None + self._durations = None + self.discriminator = None + if costs is not None: + self.costs = costs + if distances is not None: + self.distances = distances + if durations is not None: + self.durations = durations + + @property + def costs(self): + """Gets the costs of this OptimizationMatricesCyclingelectric. # noqa: E501 + + costs for a custom cost matrix that will be used within all route cost evaluations # noqa: E501 + + :return: The costs of this OptimizationMatricesCyclingelectric. # noqa: E501 + :rtype: list[list[int]] + """ + return self._costs + + @costs.setter + def costs(self, costs): + """Sets the costs of this OptimizationMatricesCyclingelectric. + + costs for a custom cost matrix that will be used within all route cost evaluations # noqa: E501 + + :param costs: The costs of this OptimizationMatricesCyclingelectric. # noqa: E501 + :type: list[list[int]] + """ + + self._costs = costs + + @property + def distances(self): + """Gets the distances of this OptimizationMatricesCyclingelectric. # noqa: E501 + + distances for a custom distance matrix # noqa: E501 + + :return: The distances of this OptimizationMatricesCyclingelectric. # noqa: E501 + :rtype: list[list[int]] + """ + return self._distances + + @distances.setter + def distances(self, distances): + """Sets the distances of this OptimizationMatricesCyclingelectric. + + distances for a custom distance matrix # noqa: E501 + + :param distances: The distances of this OptimizationMatricesCyclingelectric. # noqa: E501 + :type: list[list[int]] + """ + + self._distances = distances + + @property + def durations(self): + """Gets the durations of this OptimizationMatricesCyclingelectric. # noqa: E501 + + Durations for a custom travel-time matrix that will be used for all checks against timing constraints # noqa: E501 + + :return: The durations of this OptimizationMatricesCyclingelectric. # noqa: E501 + :rtype: list[list[int]] + """ + return self._durations + + @durations.setter + def durations(self, durations): + """Sets the durations of this OptimizationMatricesCyclingelectric. + + Durations for a custom travel-time matrix that will be used for all checks against timing constraints # noqa: E501 + + :param durations: The durations of this OptimizationMatricesCyclingelectric. # noqa: E501 + :type: list[list[int]] + """ + + self._durations = durations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationMatricesCyclingelectric, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationMatricesCyclingelectric): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_options.py b/openrouteservice/models/optimization_options.py new file mode 100644 index 00000000..e8e185d8 --- /dev/null +++ b/openrouteservice/models/optimization_options.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationOptions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'g': 'bool' + } + + attribute_map = { + 'g': 'g' + } + + def __init__(self, g=None): # noqa: E501 + """OptimizationOptions - a model defined in Swagger""" # noqa: E501 + self._g = None + self.discriminator = None + if g is not None: + self.g = g + + @property + def g(self): + """Gets the g of this OptimizationOptions. # noqa: E501 + + Calculate geometries for the optimized routes. # noqa: E501 + + :return: The g of this OptimizationOptions. # noqa: E501 + :rtype: bool + """ + return self._g + + @g.setter + def g(self, g): + """Sets the g of this OptimizationOptions. + + Calculate geometries for the optimized routes. # noqa: E501 + + :param g: The g of this OptimizationOptions. # noqa: E501 + :type: bool + """ + + self._g = g + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationOptions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationOptions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_steps.py b/openrouteservice/models/optimization_steps.py new file mode 100644 index 00000000..bef584b7 --- /dev/null +++ b/openrouteservice/models/optimization_steps.py @@ -0,0 +1,230 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationSteps(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'float', + 'service_after': 'float', + 'service_at': 'float', + 'service_before': 'float', + 'type': 'str' + } + + attribute_map = { + 'id': 'id', + 'service_after': 'service_after', + 'service_at': 'service_at', + 'service_before': 'service_before', + 'type': 'type' + } + + def __init__(self, id=None, service_after=None, service_at=None, service_before=None, type=None): # noqa: E501 + """OptimizationSteps - a model defined in Swagger""" # noqa: E501 + self._id = None + self._service_after = None + self._service_at = None + self._service_before = None + self._type = None + self.discriminator = None + if id is not None: + self.id = id + if service_after is not None: + self.service_after = service_after + if service_at is not None: + self.service_at = service_at + if service_before is not None: + self.service_before = service_before + if type is not None: + self.type = type + + @property + def id(self): + """Gets the id of this OptimizationSteps. # noqa: E501 + + id of the task to be performed at this step if `type` value is not `start` or `end` # noqa: E501 + + :return: The id of this OptimizationSteps. # noqa: E501 + :rtype: float + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OptimizationSteps. + + id of the task to be performed at this step if `type` value is not `start` or `end` # noqa: E501 + + :param id: The id of this OptimizationSteps. # noqa: E501 + :type: float + """ + + self._id = id + + @property + def service_after(self): + """Gets the service_after of this OptimizationSteps. # noqa: E501 + + hard constraint on service time lower bound (as absolute or relative timestamp) # noqa: E501 + + :return: The service_after of this OptimizationSteps. # noqa: E501 + :rtype: float + """ + return self._service_after + + @service_after.setter + def service_after(self, service_after): + """Sets the service_after of this OptimizationSteps. + + hard constraint on service time lower bound (as absolute or relative timestamp) # noqa: E501 + + :param service_after: The service_after of this OptimizationSteps. # noqa: E501 + :type: float + """ + + self._service_after = service_after + + @property + def service_at(self): + """Gets the service_at of this OptimizationSteps. # noqa: E501 + + hard constraint on service time (as absolute or relative timestamp) # noqa: E501 + + :return: The service_at of this OptimizationSteps. # noqa: E501 + :rtype: float + """ + return self._service_at + + @service_at.setter + def service_at(self, service_at): + """Sets the service_at of this OptimizationSteps. + + hard constraint on service time (as absolute or relative timestamp) # noqa: E501 + + :param service_at: The service_at of this OptimizationSteps. # noqa: E501 + :type: float + """ + + self._service_at = service_at + + @property + def service_before(self): + """Gets the service_before of this OptimizationSteps. # noqa: E501 + + hard constraint on service time upper bound (as absolute or relative timestamp) # noqa: E501 + + :return: The service_before of this OptimizationSteps. # noqa: E501 + :rtype: float + """ + return self._service_before + + @service_before.setter + def service_before(self, service_before): + """Sets the service_before of this OptimizationSteps. + + hard constraint on service time upper bound (as absolute or relative timestamp) # noqa: E501 + + :param service_before: The service_before of this OptimizationSteps. # noqa: E501 + :type: float + """ + + self._service_before = service_before + + @property + def type(self): + """Gets the type of this OptimizationSteps. # noqa: E501 + + step type (either start, job, pickup, delivery, break or end)] # noqa: E501 + + :return: The type of this OptimizationSteps. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OptimizationSteps. + + step type (either start, job, pickup, delivery, break or end)] # noqa: E501 + + :param type: The type of this OptimizationSteps. # noqa: E501 + :type: str + """ + allowed_values = ["start", "job", "pickup", "delivery", "break", "end"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationSteps, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationSteps): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/optimization_vehicles.py b/openrouteservice/models/optimization_vehicles.py new file mode 100644 index 00000000..42bce992 --- /dev/null +++ b/openrouteservice/models/optimization_vehicles.py @@ -0,0 +1,562 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptimizationVehicles(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'breaks': 'list[OptimizationBreaks]', + 'capacity': 'list[int]', + 'costs': 'OptimizationCosts', + 'description': 'str', + 'end': 'list[float]', + 'end_index': 'object', + 'id': 'int', + 'max_distance': 'float', + 'max_tasks': 'float', + 'max_travel_time': 'float', + 'profile': 'str', + 'skills': 'list[int]', + 'speed_factor': 'float', + 'start': 'list[float]', + 'start_index': 'object', + 'steps': 'list[OptimizationSteps]', + 'time_window': 'list[int]' + } + + attribute_map = { + 'breaks': 'breaks', + 'capacity': 'capacity', + 'costs': 'costs', + 'description': 'description', + 'end': 'end', + 'end_index': 'end_index', + 'id': 'id', + 'max_distance': 'max_distance', + 'max_tasks': 'max_tasks', + 'max_travel_time': 'max_travel_time', + 'profile': 'profile', + 'skills': 'skills', + 'speed_factor': 'speed_factor', + 'start': 'start', + 'start_index': 'start_index', + 'steps': 'steps', + 'time_window': 'time_window' + } + + def __init__(self, breaks=None, capacity=None, costs=None, description=None, end=None, end_index=None, id=None, max_distance=None, max_tasks=None, max_travel_time=None, profile=None, skills=None, speed_factor=None, start=None, start_index=None, steps=None, time_window=None): # noqa: E501 + """OptimizationVehicles - a model defined in Swagger""" # noqa: E501 + self._breaks = None + self._capacity = None + self._costs = None + self._description = None + self._end = None + self._end_index = None + self._id = None + self._max_distance = None + self._max_tasks = None + self._max_travel_time = None + self._profile = None + self._skills = None + self._speed_factor = None + self._start = None + self._start_index = None + self._steps = None + self._time_window = None + self.discriminator = None + if breaks is not None: + self.breaks = breaks + if capacity is not None: + self.capacity = capacity + if costs is not None: + self.costs = costs + if description is not None: + self.description = description + if end is not None: + self.end = end + if end_index is not None: + self.end_index = end_index + if id is not None: + self.id = id + if max_distance is not None: + self.max_distance = max_distance + if max_tasks is not None: + self.max_tasks = max_tasks + if max_travel_time is not None: + self.max_travel_time = max_travel_time + if profile is not None: + self.profile = profile + if skills is not None: + self.skills = skills + if speed_factor is not None: + self.speed_factor = speed_factor + if start is not None: + self.start = start + if start_index is not None: + self.start_index = start_index + if steps is not None: + self.steps = steps + if time_window is not None: + self.time_window = time_window + + @property + def breaks(self): + """Gets the breaks of this OptimizationVehicles. # noqa: E501 + + An array of `break` objects # noqa: E501 + + :return: The breaks of this OptimizationVehicles. # noqa: E501 + :rtype: list[OptimizationBreaks] + """ + return self._breaks + + @breaks.setter + def breaks(self, breaks): + """Sets the breaks of this OptimizationVehicles. + + An array of `break` objects # noqa: E501 + + :param breaks: The breaks of this OptimizationVehicles. # noqa: E501 + :type: list[OptimizationBreaks] + """ + + self._breaks = breaks + + @property + def capacity(self): + """Gets the capacity of this OptimizationVehicles. # noqa: E501 + + Array of integers describing multidimensional quantities. # noqa: E501 + + :return: The capacity of this OptimizationVehicles. # noqa: E501 + :rtype: list[int] + """ + return self._capacity + + @capacity.setter + def capacity(self, capacity): + """Sets the capacity of this OptimizationVehicles. + + Array of integers describing multidimensional quantities. # noqa: E501 + + :param capacity: The capacity of this OptimizationVehicles. # noqa: E501 + :type: list[int] + """ + + self._capacity = capacity + + @property + def costs(self): + """Gets the costs of this OptimizationVehicles. # noqa: E501 + + + :return: The costs of this OptimizationVehicles. # noqa: E501 + :rtype: OptimizationCosts + """ + return self._costs + + @costs.setter + def costs(self, costs): + """Sets the costs of this OptimizationVehicles. + + + :param costs: The costs of this OptimizationVehicles. # noqa: E501 + :type: OptimizationCosts + """ + + self._costs = costs + + @property + def description(self): + """Gets the description of this OptimizationVehicles. # noqa: E501 + + a string describing this vehicle # noqa: E501 + + :return: The description of this OptimizationVehicles. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this OptimizationVehicles. + + a string describing this vehicle # noqa: E501 + + :param description: The description of this OptimizationVehicles. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def end(self): + """Gets the end of this OptimizationVehicles. # noqa: E501 + + End coordinates array in `[lon, lat]` format. If left blank, the optimization engine will identify the optimal end point. # noqa: E501 + + :return: The end of this OptimizationVehicles. # noqa: E501 + :rtype: list[float] + """ + return self._end + + @end.setter + def end(self, end): + """Sets the end of this OptimizationVehicles. + + End coordinates array in `[lon, lat]` format. If left blank, the optimization engine will identify the optimal end point. # noqa: E501 + + :param end: The end of this OptimizationVehicles. # noqa: E501 + :type: list[float] + """ + + self._end = end + + @property + def end_index(self): + """Gets the end_index of this OptimizationVehicles. # noqa: E501 + + Index of relevant row and column in custom matrix. # noqa: E501 + + :return: The end_index of this OptimizationVehicles. # noqa: E501 + :rtype: object + """ + return self._end_index + + @end_index.setter + def end_index(self, end_index): + """Sets the end_index of this OptimizationVehicles. + + Index of relevant row and column in custom matrix. # noqa: E501 + + :param end_index: The end_index of this OptimizationVehicles. # noqa: E501 + :type: object + """ + + self._end_index = end_index + + @property + def id(self): + """Gets the id of this OptimizationVehicles. # noqa: E501 + + Integer used as unique identifier # noqa: E501 + + :return: The id of this OptimizationVehicles. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OptimizationVehicles. + + Integer used as unique identifier # noqa: E501 + + :param id: The id of this OptimizationVehicles. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def max_distance(self): + """Gets the max_distance of this OptimizationVehicles. # noqa: E501 + + an integer defining the maximum distance for this vehicle # noqa: E501 + + :return: The max_distance of this OptimizationVehicles. # noqa: E501 + :rtype: float + """ + return self._max_distance + + @max_distance.setter + def max_distance(self, max_distance): + """Sets the max_distance of this OptimizationVehicles. + + an integer defining the maximum distance for this vehicle # noqa: E501 + + :param max_distance: The max_distance of this OptimizationVehicles. # noqa: E501 + :type: float + """ + + self._max_distance = max_distance + + @property + def max_tasks(self): + """Gets the max_tasks of this OptimizationVehicles. # noqa: E501 + + an integer defining the maximum number of tasks in a route for this vehicle # noqa: E501 + + :return: The max_tasks of this OptimizationVehicles. # noqa: E501 + :rtype: float + """ + return self._max_tasks + + @max_tasks.setter + def max_tasks(self, max_tasks): + """Sets the max_tasks of this OptimizationVehicles. + + an integer defining the maximum number of tasks in a route for this vehicle # noqa: E501 + + :param max_tasks: The max_tasks of this OptimizationVehicles. # noqa: E501 + :type: float + """ + + self._max_tasks = max_tasks + + @property + def max_travel_time(self): + """Gets the max_travel_time of this OptimizationVehicles. # noqa: E501 + + an integer defining the maximum travel time for this vehicle # noqa: E501 + + :return: The max_travel_time of this OptimizationVehicles. # noqa: E501 + :rtype: float + """ + return self._max_travel_time + + @max_travel_time.setter + def max_travel_time(self, max_travel_time): + """Sets the max_travel_time of this OptimizationVehicles. + + an integer defining the maximum travel time for this vehicle # noqa: E501 + + :param max_travel_time: The max_travel_time of this OptimizationVehicles. # noqa: E501 + :type: float + """ + + self._max_travel_time = max_travel_time + + @property + def profile(self): + """Gets the profile of this OptimizationVehicles. # noqa: E501 + + The ORS routing profile for the vehicle. # noqa: E501 + + :return: The profile of this OptimizationVehicles. # noqa: E501 + :rtype: str + """ + return self._profile + + @profile.setter + def profile(self, profile): + """Sets the profile of this OptimizationVehicles. + + The ORS routing profile for the vehicle. # noqa: E501 + + :param profile: The profile of this OptimizationVehicles. # noqa: E501 + :type: str + """ + allowed_values = ["driving-car", "driving-hgv", "cycling-regular", "cycling-mountain", "cycling-electric", "cycling-road", "foot-walking", "foot-hiking", "wheelchair"] # noqa: E501 + if profile not in allowed_values: + raise ValueError( + "Invalid value for `profile` ({0}), must be one of {1}" # noqa: E501 + .format(profile, allowed_values) + ) + + self._profile = profile + + @property + def skills(self): + """Gets the skills of this OptimizationVehicles. # noqa: E501 + + Array of integers defining skills for this vehicle # noqa: E501 + + :return: The skills of this OptimizationVehicles. # noqa: E501 + :rtype: list[int] + """ + return self._skills + + @skills.setter + def skills(self, skills): + """Sets the skills of this OptimizationVehicles. + + Array of integers defining skills for this vehicle # noqa: E501 + + :param skills: The skills of this OptimizationVehicles. # noqa: E501 + :type: list[int] + """ + + self._skills = skills + + @property + def speed_factor(self): + """Gets the speed_factor of this OptimizationVehicles. # noqa: E501 + + A double value in the range (0, 5] used to scale all vehicle travel times (defaults to 1.). The respected precision is limited to two digits after the decimal point. # noqa: E501 + + :return: The speed_factor of this OptimizationVehicles. # noqa: E501 + :rtype: float + """ + return self._speed_factor + + @speed_factor.setter + def speed_factor(self, speed_factor): + """Sets the speed_factor of this OptimizationVehicles. + + A double value in the range (0, 5] used to scale all vehicle travel times (defaults to 1.). The respected precision is limited to two digits after the decimal point. # noqa: E501 + + :param speed_factor: The speed_factor of this OptimizationVehicles. # noqa: E501 + :type: float + """ + + self._speed_factor = speed_factor + + @property + def start(self): + """Gets the start of this OptimizationVehicles. # noqa: E501 + + Start coordinates array in `[lon, lat]` format. If left blank, the optimization engine will identify the optimal start point. # noqa: E501 + + :return: The start of this OptimizationVehicles. # noqa: E501 + :rtype: list[float] + """ + return self._start + + @start.setter + def start(self, start): + """Sets the start of this OptimizationVehicles. + + Start coordinates array in `[lon, lat]` format. If left blank, the optimization engine will identify the optimal start point. # noqa: E501 + + :param start: The start of this OptimizationVehicles. # noqa: E501 + :type: list[float] + """ + + self._start = start + + @property + def start_index(self): + """Gets the start_index of this OptimizationVehicles. # noqa: E501 + + Index of relevant row and column in custom matrix. # noqa: E501 + + :return: The start_index of this OptimizationVehicles. # noqa: E501 + :rtype: object + """ + return self._start_index + + @start_index.setter + def start_index(self, start_index): + """Sets the start_index of this OptimizationVehicles. + + Index of relevant row and column in custom matrix. # noqa: E501 + + :param start_index: The start_index of this OptimizationVehicles. # noqa: E501 + :type: object + """ + + self._start_index = start_index + + @property + def steps(self): + """Gets the steps of this OptimizationVehicles. # noqa: E501 + + + :return: The steps of this OptimizationVehicles. # noqa: E501 + :rtype: list[OptimizationSteps] + """ + return self._steps + + @steps.setter + def steps(self, steps): + """Sets the steps of this OptimizationVehicles. + + + :param steps: The steps of this OptimizationVehicles. # noqa: E501 + :type: list[OptimizationSteps] + """ + + self._steps = steps + + @property + def time_window(self): + """Gets the time_window of this OptimizationVehicles. # noqa: E501 + + A `time_window` array describing working hours for this vehicle, in week seconds, i.e. 28800 = Mon, 8 AM. # noqa: E501 + + :return: The time_window of this OptimizationVehicles. # noqa: E501 + :rtype: list[int] + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this OptimizationVehicles. + + A `time_window` array describing working hours for this vehicle, in week seconds, i.e. 28800 = Mon, 8 AM. # noqa: E501 + + :param time_window: The time_window of this OptimizationVehicles. # noqa: E501 + :type: list[int] + """ + + self._time_window = time_window + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptimizationVehicles, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptimizationVehicles): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/pois_filters.py b/openrouteservice/models/pois_filters.py new file mode 100644 index 00000000..459cc3f2 --- /dev/null +++ b/openrouteservice/models/pois_filters.py @@ -0,0 +1,248 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class PoisFilters(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'category_group_ids': 'list[int]', + 'category_ids': 'list[int]', + 'fee': 'list[str]', + 'name': 'list[str]', + 'smoking': 'list[str]', + 'wheelchair': 'list[str]' + } + + attribute_map = { + 'category_group_ids': 'category_group_ids', + 'category_ids': 'category_ids', + 'fee': 'fee', + 'name': 'name', + 'smoking': 'smoking', + 'wheelchair': 'wheelchair' + } + + def __init__(self, category_group_ids=None, category_ids=None, fee=None, name=None, smoking=None, wheelchair=None): # noqa: E501 + """PoisFilters - a model defined in Swagger""" # noqa: E501 + self._category_group_ids = None + self._category_ids = None + self._fee = None + self._name = None + self._smoking = None + self._wheelchair = None + self.discriminator = None + if category_group_ids is not None: + self.category_group_ids = category_group_ids + if category_ids is not None: + self.category_ids = category_ids + if fee is not None: + self.fee = fee + if name is not None: + self.name = name + if smoking is not None: + self.smoking = smoking + if wheelchair is not None: + self.wheelchair = wheelchair + + @property + def category_group_ids(self): + """Gets the category_group_ids of this PoisFilters. # noqa: E501 + + + :return: The category_group_ids of this PoisFilters. # noqa: E501 + :rtype: list[int] + """ + return self._category_group_ids + + @category_group_ids.setter + def category_group_ids(self, category_group_ids): + """Sets the category_group_ids of this PoisFilters. + + + :param category_group_ids: The category_group_ids of this PoisFilters. # noqa: E501 + :type: list[int] + """ + + self._category_group_ids = category_group_ids + + @property + def category_ids(self): + """Gets the category_ids of this PoisFilters. # noqa: E501 + + + :return: The category_ids of this PoisFilters. # noqa: E501 + :rtype: list[int] + """ + return self._category_ids + + @category_ids.setter + def category_ids(self, category_ids): + """Sets the category_ids of this PoisFilters. + + + :param category_ids: The category_ids of this PoisFilters. # noqa: E501 + :type: list[int] + """ + + self._category_ids = category_ids + + @property + def fee(self): + """Gets the fee of this PoisFilters. # noqa: E501 + + Filter example. # noqa: E501 + + :return: The fee of this PoisFilters. # noqa: E501 + :rtype: list[str] + """ + return self._fee + + @fee.setter + def fee(self, fee): + """Sets the fee of this PoisFilters. + + Filter example. # noqa: E501 + + :param fee: The fee of this PoisFilters. # noqa: E501 + :type: list[str] + """ + + self._fee = fee + + @property + def name(self): + """Gets the name of this PoisFilters. # noqa: E501 + + Filter by name of the poi object. # noqa: E501 + + :return: The name of this PoisFilters. # noqa: E501 + :rtype: list[str] + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this PoisFilters. + + Filter by name of the poi object. # noqa: E501 + + :param name: The name of this PoisFilters. # noqa: E501 + :type: list[str] + """ + + self._name = name + + @property + def smoking(self): + """Gets the smoking of this PoisFilters. # noqa: E501 + + Filter example. # noqa: E501 + + :return: The smoking of this PoisFilters. # noqa: E501 + :rtype: list[str] + """ + return self._smoking + + @smoking.setter + def smoking(self, smoking): + """Sets the smoking of this PoisFilters. + + Filter example. # noqa: E501 + + :param smoking: The smoking of this PoisFilters. # noqa: E501 + :type: list[str] + """ + + self._smoking = smoking + + @property + def wheelchair(self): + """Gets the wheelchair of this PoisFilters. # noqa: E501 + + Filter example. # noqa: E501 + + :return: The wheelchair of this PoisFilters. # noqa: E501 + :rtype: list[str] + """ + return self._wheelchair + + @wheelchair.setter + def wheelchair(self, wheelchair): + """Sets the wheelchair of this PoisFilters. + + Filter example. # noqa: E501 + + :param wheelchair: The wheelchair of this PoisFilters. # noqa: E501 + :type: list[str] + """ + + self._wheelchair = wheelchair + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PoisFilters, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PoisFilters): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/pois_geometry.py b/openrouteservice/models/pois_geometry.py new file mode 100644 index 00000000..c7bde43f --- /dev/null +++ b/openrouteservice/models/pois_geometry.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class PoisGeometry(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bbox': 'list[float]', + 'buffer': 'int', + 'geojson': 'object' + } + + attribute_map = { + 'bbox': 'bbox', + 'buffer': 'buffer', + 'geojson': 'geojson' + } + + def __init__(self, bbox=None, buffer=None, geojson=None): # noqa: E501 + """PoisGeometry - a model defined in Swagger""" # noqa: E501 + self._bbox = None + self._buffer = None + self._geojson = None + self.discriminator = None + if bbox is not None: + self.bbox = bbox + if buffer is not None: + self.buffer = buffer + if geojson is not None: + self.geojson = geojson + + @property + def bbox(self): + """Gets the bbox of this PoisGeometry. # noqa: E501 + + The pattern for this bbox string is minlon,minlat,maxlon,maxlat # noqa: E501 + + :return: The bbox of this PoisGeometry. # noqa: E501 + :rtype: list[float] + """ + return self._bbox + + @bbox.setter + def bbox(self, bbox): + """Sets the bbox of this PoisGeometry. + + The pattern for this bbox string is minlon,minlat,maxlon,maxlat # noqa: E501 + + :param bbox: The bbox of this PoisGeometry. # noqa: E501 + :type: list[float] + """ + + self._bbox = bbox + + @property + def buffer(self): + """Gets the buffer of this PoisGeometry. # noqa: E501 + + + :return: The buffer of this PoisGeometry. # noqa: E501 + :rtype: int + """ + return self._buffer + + @buffer.setter + def buffer(self, buffer): + """Sets the buffer of this PoisGeometry. + + + :param buffer: The buffer of this PoisGeometry. # noqa: E501 + :type: int + """ + + self._buffer = buffer + + @property + def geojson(self): + """Gets the geojson of this PoisGeometry. # noqa: E501 + + This is a GeoJSON object. Is either Point, Polygon or LineString. # noqa: E501 + + :return: The geojson of this PoisGeometry. # noqa: E501 + :rtype: object + """ + return self._geojson + + @geojson.setter + def geojson(self, geojson): + """Sets the geojson of this PoisGeometry. + + This is a GeoJSON object. Is either Point, Polygon or LineString. # noqa: E501 + + :param geojson: The geojson of this PoisGeometry. # noqa: E501 + :type: object + """ + + self._geojson = geojson + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PoisGeometry, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PoisGeometry): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/profile_geojson_body.py b/openrouteservice/models/profile_geojson_body.py new file mode 100644 index 00000000..2f88b29d --- /dev/null +++ b/openrouteservice/models/profile_geojson_body.py @@ -0,0 +1,170 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class ProfileGeojsonBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'locations': 'list[list[float]]', + 'radius': 'float' + } + + attribute_map = { + 'id': 'id', + 'locations': 'locations', + 'radius': 'radius' + } + + def __init__(self, id=None, locations=None, radius=None): # noqa: E501 + """ProfileGeojsonBody - a model defined in Swagger""" # noqa: E501 + self._id = None + self._locations = None + self._radius = None + self.discriminator = None + if id is not None: + self.id = id + self.locations = locations + self.radius = radius + + @property + def id(self): + """Gets the id of this ProfileGeojsonBody. # noqa: E501 + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :return: The id of this ProfileGeojsonBody. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ProfileGeojsonBody. + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :param id: The id of this ProfileGeojsonBody. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def locations(self): + """Gets the locations of this ProfileGeojsonBody. # noqa: E501 + + The locations to be snapped as array of `longitude/latitude` pairs. # noqa: E501 + + :return: The locations of this ProfileGeojsonBody. # noqa: E501 + :rtype: list[list[float]] + """ + return self._locations + + @locations.setter + def locations(self, locations): + """Sets the locations of this ProfileGeojsonBody. + + The locations to be snapped as array of `longitude/latitude` pairs. # noqa: E501 + + :param locations: The locations of this ProfileGeojsonBody. # noqa: E501 + :type: list[list[float]] + """ + if locations is None: + raise ValueError("Invalid value for `locations`, must not be `None`") # noqa: E501 + + self._locations = locations + + @property + def radius(self): + """Gets the radius of this ProfileGeojsonBody. # noqa: E501 + + Maximum radius in meters around given coordinates to search for graph edges. # noqa: E501 + + :return: The radius of this ProfileGeojsonBody. # noqa: E501 + :rtype: float + """ + return self._radius + + @radius.setter + def radius(self, radius): + """Sets the radius of this ProfileGeojsonBody. + + Maximum radius in meters around given coordinates to search for graph edges. # noqa: E501 + + :param radius: The radius of this ProfileGeojsonBody. # noqa: E501 + :type: float + """ + if radius is None: + raise ValueError("Invalid value for `radius`, must not be `None`") # noqa: E501 + + self._radius = radius + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProfileGeojsonBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProfileGeojsonBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/profile_json_body.py b/openrouteservice/models/profile_json_body.py new file mode 100644 index 00000000..635ec555 --- /dev/null +++ b/openrouteservice/models/profile_json_body.py @@ -0,0 +1,170 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class ProfileJsonBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'locations': 'list[list[float]]', + 'radius': 'float' + } + + attribute_map = { + 'id': 'id', + 'locations': 'locations', + 'radius': 'radius' + } + + def __init__(self, id=None, locations=None, radius=None): # noqa: E501 + """ProfileJsonBody - a model defined in Swagger""" # noqa: E501 + self._id = None + self._locations = None + self._radius = None + self.discriminator = None + if id is not None: + self.id = id + self.locations = locations + self.radius = radius + + @property + def id(self): + """Gets the id of this ProfileJsonBody. # noqa: E501 + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :return: The id of this ProfileJsonBody. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ProfileJsonBody. + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :param id: The id of this ProfileJsonBody. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def locations(self): + """Gets the locations of this ProfileJsonBody. # noqa: E501 + + The locations to be snapped as array of `longitude/latitude` pairs. # noqa: E501 + + :return: The locations of this ProfileJsonBody. # noqa: E501 + :rtype: list[list[float]] + """ + return self._locations + + @locations.setter + def locations(self, locations): + """Sets the locations of this ProfileJsonBody. + + The locations to be snapped as array of `longitude/latitude` pairs. # noqa: E501 + + :param locations: The locations of this ProfileJsonBody. # noqa: E501 + :type: list[list[float]] + """ + if locations is None: + raise ValueError("Invalid value for `locations`, must not be `None`") # noqa: E501 + + self._locations = locations + + @property + def radius(self): + """Gets the radius of this ProfileJsonBody. # noqa: E501 + + Maximum radius in meters around given coordinates to search for graph edges. # noqa: E501 + + :return: The radius of this ProfileJsonBody. # noqa: E501 + :rtype: float + """ + return self._radius + + @radius.setter + def radius(self, radius): + """Sets the radius of this ProfileJsonBody. + + Maximum radius in meters around given coordinates to search for graph edges. # noqa: E501 + + :param radius: The radius of this ProfileJsonBody. # noqa: E501 + :type: float + """ + if radius is None: + raise ValueError("Invalid value for `radius`, must not be `None`") # noqa: E501 + + self._radius = radius + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProfileJsonBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProfileJsonBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/profile_parameters.py b/openrouteservice/models/profile_parameters.py new file mode 100644 index 00000000..c6a16513 --- /dev/null +++ b/openrouteservice/models/profile_parameters.py @@ -0,0 +1,192 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class ProfileParameters(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_unsuitable': 'bool', + 'restrictions': 'ProfileParametersRestrictions', + 'surface_quality_known': 'bool', + 'weightings': 'ProfileWeightings' + } + + attribute_map = { + 'allow_unsuitable': 'allow_unsuitable', + 'restrictions': 'restrictions', + 'surface_quality_known': 'surface_quality_known', + 'weightings': 'weightings' + } + + def __init__(self, allow_unsuitable=None, restrictions=None, surface_quality_known=None, weightings=None): # noqa: E501 + """ProfileParameters - a model defined in Swagger""" # noqa: E501 + self._allow_unsuitable = None + self._restrictions = None + self._surface_quality_known = None + self._weightings = None + self.discriminator = None + if allow_unsuitable is not None: + self.allow_unsuitable = allow_unsuitable + if restrictions is not None: + self.restrictions = restrictions + if surface_quality_known is not None: + self.surface_quality_known = surface_quality_known + if weightings is not None: + self.weightings = weightings + + @property + def allow_unsuitable(self): + """Gets the allow_unsuitable of this ProfileParameters. # noqa: E501 + + Specifies if ways that might not be suitable (e.g. unknown pedestrian usage) should be included in finding routes - default false # noqa: E501 + + :return: The allow_unsuitable of this ProfileParameters. # noqa: E501 + :rtype: bool + """ + return self._allow_unsuitable + + @allow_unsuitable.setter + def allow_unsuitable(self, allow_unsuitable): + """Sets the allow_unsuitable of this ProfileParameters. + + Specifies if ways that might not be suitable (e.g. unknown pedestrian usage) should be included in finding routes - default false # noqa: E501 + + :param allow_unsuitable: The allow_unsuitable of this ProfileParameters. # noqa: E501 + :type: bool + """ + + self._allow_unsuitable = allow_unsuitable + + @property + def restrictions(self): + """Gets the restrictions of this ProfileParameters. # noqa: E501 + + + :return: The restrictions of this ProfileParameters. # noqa: E501 + :rtype: ProfileParametersRestrictions + """ + return self._restrictions + + @restrictions.setter + def restrictions(self, restrictions): + """Sets the restrictions of this ProfileParameters. + + + :param restrictions: The restrictions of this ProfileParameters. # noqa: E501 + :type: ProfileParametersRestrictions + """ + + self._restrictions = restrictions + + @property + def surface_quality_known(self): + """Gets the surface_quality_known of this ProfileParameters. # noqa: E501 + + Specifies whether to enforce that only ways with known information on surface quality be taken into account - default false # noqa: E501 + + :return: The surface_quality_known of this ProfileParameters. # noqa: E501 + :rtype: bool + """ + return self._surface_quality_known + + @surface_quality_known.setter + def surface_quality_known(self, surface_quality_known): + """Sets the surface_quality_known of this ProfileParameters. + + Specifies whether to enforce that only ways with known information on surface quality be taken into account - default false # noqa: E501 + + :param surface_quality_known: The surface_quality_known of this ProfileParameters. # noqa: E501 + :type: bool + """ + + self._surface_quality_known = surface_quality_known + + @property + def weightings(self): + """Gets the weightings of this ProfileParameters. # noqa: E501 + + + :return: The weightings of this ProfileParameters. # noqa: E501 + :rtype: ProfileWeightings + """ + return self._weightings + + @weightings.setter + def weightings(self, weightings): + """Sets the weightings of this ProfileParameters. + + + :param weightings: The weightings of this ProfileParameters. # noqa: E501 + :type: ProfileWeightings + """ + + self._weightings = weightings + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProfileParameters, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProfileParameters): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/profile_parameters_restrictions.py b/openrouteservice/models/profile_parameters_restrictions.py new file mode 100644 index 00000000..f30ab5ab --- /dev/null +++ b/openrouteservice/models/profile_parameters_restrictions.py @@ -0,0 +1,426 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class ProfileParametersRestrictions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'axleload': 'float', + 'hazmat': 'bool', + 'height': 'float', + 'length': 'float', + 'maximum_incline': 'int', + 'maximum_sloped_kerb': 'float', + 'minimum_width': 'float', + 'smoothness_type': 'str', + 'surface_type': 'str', + 'track_type': 'str', + 'weight': 'float', + 'width': 'float' + } + + attribute_map = { + 'axleload': 'axleload', + 'hazmat': 'hazmat', + 'height': 'height', + 'length': 'length', + 'maximum_incline': 'maximum_incline', + 'maximum_sloped_kerb': 'maximum_sloped_kerb', + 'minimum_width': 'minimum_width', + 'smoothness_type': 'smoothness_type', + 'surface_type': 'surface_type', + 'track_type': 'track_type', + 'weight': 'weight', + 'width': 'width' + } + + def __init__(self, axleload=None, hazmat=False, height=None, length=None, maximum_incline=6, maximum_sloped_kerb=0.6, minimum_width=None, smoothness_type='good', surface_type='sett', track_type='grade1', weight=None, width=None): # noqa: E501 + """ProfileParametersRestrictions - a model defined in Swagger""" # noqa: E501 + self._axleload = None + self._hazmat = None + self._height = None + self._length = None + self._maximum_incline = None + self._maximum_sloped_kerb = None + self._minimum_width = None + self._smoothness_type = None + self._surface_type = None + self._track_type = None + self._weight = None + self._width = None + self.discriminator = None + if axleload is not None: + self.axleload = axleload + if hazmat is not None: + self.hazmat = hazmat + if height is not None: + self.height = height + if length is not None: + self.length = length + if maximum_incline is not None: + self.maximum_incline = maximum_incline + if maximum_sloped_kerb is not None: + self.maximum_sloped_kerb = maximum_sloped_kerb + if minimum_width is not None: + self.minimum_width = minimum_width + if smoothness_type is not None: + self.smoothness_type = smoothness_type + if surface_type is not None: + self.surface_type = surface_type + if track_type is not None: + self.track_type = track_type + if weight is not None: + self.weight = weight + if width is not None: + self.width = width + + @property + def axleload(self): + """Gets the axleload of this ProfileParametersRestrictions. # noqa: E501 + + Axleload restriction in tons. # noqa: E501 + + :return: The axleload of this ProfileParametersRestrictions. # noqa: E501 + :rtype: float + """ + return self._axleload + + @axleload.setter + def axleload(self, axleload): + """Sets the axleload of this ProfileParametersRestrictions. + + Axleload restriction in tons. # noqa: E501 + + :param axleload: The axleload of this ProfileParametersRestrictions. # noqa: E501 + :type: float + """ + + self._axleload = axleload + + @property + def hazmat(self): + """Gets the hazmat of this ProfileParametersRestrictions. # noqa: E501 + + Specifies whether to use appropriate routing for delivering hazardous goods and avoiding water protected areas. Default is `false`. # noqa: E501 + + :return: The hazmat of this ProfileParametersRestrictions. # noqa: E501 + :rtype: bool + """ + return self._hazmat + + @hazmat.setter + def hazmat(self, hazmat): + """Sets the hazmat of this ProfileParametersRestrictions. + + Specifies whether to use appropriate routing for delivering hazardous goods and avoiding water protected areas. Default is `false`. # noqa: E501 + + :param hazmat: The hazmat of this ProfileParametersRestrictions. # noqa: E501 + :type: bool + """ + + self._hazmat = hazmat + + @property + def height(self): + """Gets the height of this ProfileParametersRestrictions. # noqa: E501 + + Height restriction in metres. # noqa: E501 + + :return: The height of this ProfileParametersRestrictions. # noqa: E501 + :rtype: float + """ + return self._height + + @height.setter + def height(self, height): + """Sets the height of this ProfileParametersRestrictions. + + Height restriction in metres. # noqa: E501 + + :param height: The height of this ProfileParametersRestrictions. # noqa: E501 + :type: float + """ + + self._height = height + + @property + def length(self): + """Gets the length of this ProfileParametersRestrictions. # noqa: E501 + + Length restriction in metres. # noqa: E501 + + :return: The length of this ProfileParametersRestrictions. # noqa: E501 + :rtype: float + """ + return self._length + + @length.setter + def length(self, length): + """Sets the length of this ProfileParametersRestrictions. + + Length restriction in metres. # noqa: E501 + + :param length: The length of this ProfileParametersRestrictions. # noqa: E501 + :type: float + """ + + self._length = length + + @property + def maximum_incline(self): + """Gets the maximum_incline of this ProfileParametersRestrictions. # noqa: E501 + + Specifies the maximum incline as a percentage. `3`, `6` (default), `10`, `15. # noqa: E501 + + :return: The maximum_incline of this ProfileParametersRestrictions. # noqa: E501 + :rtype: int + """ + return self._maximum_incline + + @maximum_incline.setter + def maximum_incline(self, maximum_incline): + """Sets the maximum_incline of this ProfileParametersRestrictions. + + Specifies the maximum incline as a percentage. `3`, `6` (default), `10`, `15. # noqa: E501 + + :param maximum_incline: The maximum_incline of this ProfileParametersRestrictions. # noqa: E501 + :type: int + """ + + self._maximum_incline = maximum_incline + + @property + def maximum_sloped_kerb(self): + """Gets the maximum_sloped_kerb of this ProfileParametersRestrictions. # noqa: E501 + + Specifies the maximum height of the sloped curb in metres. Values are `0.03`, `0.06` (default), `0.1`. # noqa: E501 + + :return: The maximum_sloped_kerb of this ProfileParametersRestrictions. # noqa: E501 + :rtype: float + """ + return self._maximum_sloped_kerb + + @maximum_sloped_kerb.setter + def maximum_sloped_kerb(self, maximum_sloped_kerb): + """Sets the maximum_sloped_kerb of this ProfileParametersRestrictions. + + Specifies the maximum height of the sloped curb in metres. Values are `0.03`, `0.06` (default), `0.1`. # noqa: E501 + + :param maximum_sloped_kerb: The maximum_sloped_kerb of this ProfileParametersRestrictions. # noqa: E501 + :type: float + """ + + self._maximum_sloped_kerb = maximum_sloped_kerb + + @property + def minimum_width(self): + """Gets the minimum_width of this ProfileParametersRestrictions. # noqa: E501 + + Specifies the minimum width of the footway in metres. # noqa: E501 + + :return: The minimum_width of this ProfileParametersRestrictions. # noqa: E501 + :rtype: float + """ + return self._minimum_width + + @minimum_width.setter + def minimum_width(self, minimum_width): + """Sets the minimum_width of this ProfileParametersRestrictions. + + Specifies the minimum width of the footway in metres. # noqa: E501 + + :param minimum_width: The minimum_width of this ProfileParametersRestrictions. # noqa: E501 + :type: float + """ + + self._minimum_width = minimum_width + + @property + def smoothness_type(self): + """Gets the smoothness_type of this ProfileParametersRestrictions. # noqa: E501 + + Specifies the minimum smoothness of the route. Default is `good`. # noqa: E501 + + :return: The smoothness_type of this ProfileParametersRestrictions. # noqa: E501 + :rtype: str + """ + return self._smoothness_type + + @smoothness_type.setter + def smoothness_type(self, smoothness_type): + """Sets the smoothness_type of this ProfileParametersRestrictions. + + Specifies the minimum smoothness of the route. Default is `good`. # noqa: E501 + + :param smoothness_type: The smoothness_type of this ProfileParametersRestrictions. # noqa: E501 + :type: str + """ + allowed_values = ["excellent", "good", "intermediate", "bad", "very_bad", "horrible", "very_horrible", "impassable"] # noqa: E501 + if smoothness_type not in allowed_values: + raise ValueError( + "Invalid value for `smoothness_type` ({0}), must be one of {1}" # noqa: E501 + .format(smoothness_type, allowed_values) + ) + + self._smoothness_type = smoothness_type + + @property + def surface_type(self): + """Gets the surface_type of this ProfileParametersRestrictions. # noqa: E501 + + Specifies the minimum surface type. Default is `sett`. # noqa: E501 + + :return: The surface_type of this ProfileParametersRestrictions. # noqa: E501 + :rtype: str + """ + return self._surface_type + + @surface_type.setter + def surface_type(self, surface_type): + """Sets the surface_type of this ProfileParametersRestrictions. + + Specifies the minimum surface type. Default is `sett`. # noqa: E501 + + :param surface_type: The surface_type of this ProfileParametersRestrictions. # noqa: E501 + :type: str + """ + + self._surface_type = surface_type + + @property + def track_type(self): + """Gets the track_type of this ProfileParametersRestrictions. # noqa: E501 + + Specifies the minimum grade of the route. Default is `grade1`. # noqa: E501 + + :return: The track_type of this ProfileParametersRestrictions. # noqa: E501 + :rtype: str + """ + return self._track_type + + @track_type.setter + def track_type(self, track_type): + """Sets the track_type of this ProfileParametersRestrictions. + + Specifies the minimum grade of the route. Default is `grade1`. # noqa: E501 + + :param track_type: The track_type of this ProfileParametersRestrictions. # noqa: E501 + :type: str + """ + + self._track_type = track_type + + @property + def weight(self): + """Gets the weight of this ProfileParametersRestrictions. # noqa: E501 + + Weight restriction in tons. # noqa: E501 + + :return: The weight of this ProfileParametersRestrictions. # noqa: E501 + :rtype: float + """ + return self._weight + + @weight.setter + def weight(self, weight): + """Sets the weight of this ProfileParametersRestrictions. + + Weight restriction in tons. # noqa: E501 + + :param weight: The weight of this ProfileParametersRestrictions. # noqa: E501 + :type: float + """ + + self._weight = weight + + @property + def width(self): + """Gets the width of this ProfileParametersRestrictions. # noqa: E501 + + Width restriction in metres. # noqa: E501 + + :return: The width of this ProfileParametersRestrictions. # noqa: E501 + :rtype: float + """ + return self._width + + @width.setter + def width(self, width): + """Sets the width of this ProfileParametersRestrictions. + + Width restriction in metres. # noqa: E501 + + :param width: The width of this ProfileParametersRestrictions. # noqa: E501 + :type: float + """ + + self._width = width + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProfileParametersRestrictions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProfileParametersRestrictions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/profile_weightings.py b/openrouteservice/models/profile_weightings.py new file mode 100644 index 00000000..407956a3 --- /dev/null +++ b/openrouteservice/models/profile_weightings.py @@ -0,0 +1,196 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class ProfileWeightings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'green': 'float', + 'quiet': 'float', + 'shadow': 'float', + 'steepness_difficulty': 'int' + } + + attribute_map = { + 'green': 'green', + 'quiet': 'quiet', + 'shadow': 'shadow', + 'steepness_difficulty': 'steepness_difficulty' + } + + def __init__(self, green=None, quiet=None, shadow=None, steepness_difficulty=None): # noqa: E501 + """ProfileWeightings - a model defined in Swagger""" # noqa: E501 + self._green = None + self._quiet = None + self._shadow = None + self._steepness_difficulty = None + self.discriminator = None + if green is not None: + self.green = green + if quiet is not None: + self.quiet = quiet + if shadow is not None: + self.shadow = shadow + if steepness_difficulty is not None: + self.steepness_difficulty = steepness_difficulty + + @property + def green(self): + """Gets the green of this ProfileWeightings. # noqa: E501 + + Specifies the Green factor for `foot-*` profiles. factor: Multiplication factor range from 0 to 1. 0 is the green routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer ways through green areas over a shorter route. # noqa: E501 + + :return: The green of this ProfileWeightings. # noqa: E501 + :rtype: float + """ + return self._green + + @green.setter + def green(self, green): + """Sets the green of this ProfileWeightings. + + Specifies the Green factor for `foot-*` profiles. factor: Multiplication factor range from 0 to 1. 0 is the green routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer ways through green areas over a shorter route. # noqa: E501 + + :param green: The green of this ProfileWeightings. # noqa: E501 + :type: float + """ + + self._green = green + + @property + def quiet(self): + """Gets the quiet of this ProfileWeightings. # noqa: E501 + + Specifies the Quiet factor for foot-* profiles. factor: Multiplication factor range from 0 to 1. 0 is the quiet routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer quiet ways over a shorter route. # noqa: E501 + + :return: The quiet of this ProfileWeightings. # noqa: E501 + :rtype: float + """ + return self._quiet + + @quiet.setter + def quiet(self, quiet): + """Sets the quiet of this ProfileWeightings. + + Specifies the Quiet factor for foot-* profiles. factor: Multiplication factor range from 0 to 1. 0 is the quiet routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer quiet ways over a shorter route. # noqa: E501 + + :param quiet: The quiet of this ProfileWeightings. # noqa: E501 + :type: float + """ + + self._quiet = quiet + + @property + def shadow(self): + """Gets the shadow of this ProfileWeightings. # noqa: E501 + + Specifies the shadow factor for `foot-*` profiles. factor: Multiplication factor range from 0 to 1. 0 is the shadow routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer ways through shadow areas over a shorter route. # noqa: E501 + + :return: The shadow of this ProfileWeightings. # noqa: E501 + :rtype: float + """ + return self._shadow + + @shadow.setter + def shadow(self, shadow): + """Sets the shadow of this ProfileWeightings. + + Specifies the shadow factor for `foot-*` profiles. factor: Multiplication factor range from 0 to 1. 0 is the shadow routing base factor without multiplying it by the manual factor and is already different from normal routing. 1 will prefer ways through shadow areas over a shorter route. # noqa: E501 + + :param shadow: The shadow of this ProfileWeightings. # noqa: E501 + :type: float + """ + + self._shadow = shadow + + @property + def steepness_difficulty(self): + """Gets the steepness_difficulty of this ProfileWeightings. # noqa: E501 + + Specifies the fitness level for `cycling-*` profiles. level: 0 = Novice, 1 = Moderate, 2 = Amateur, 3 = Pro. The prefered gradient increases with level. # noqa: E501 + + :return: The steepness_difficulty of this ProfileWeightings. # noqa: E501 + :rtype: int + """ + return self._steepness_difficulty + + @steepness_difficulty.setter + def steepness_difficulty(self, steepness_difficulty): + """Sets the steepness_difficulty of this ProfileWeightings. + + Specifies the fitness level for `cycling-*` profiles. level: 0 = Novice, 1 = Moderate, 2 = Amateur, 3 = Pro. The prefered gradient increases with level. # noqa: E501 + + :param steepness_difficulty: The steepness_difficulty of this ProfileWeightings. # noqa: E501 + :type: int + """ + + self._steepness_difficulty = steepness_difficulty + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProfileWeightings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProfileWeightings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/round_trip_route_options.py b/openrouteservice/models/round_trip_route_options.py new file mode 100644 index 00000000..91a4fed6 --- /dev/null +++ b/openrouteservice/models/round_trip_route_options.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class RoundTripRouteOptions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'length': 'float', + 'points': 'int', + 'seed': 'int' + } + + attribute_map = { + 'length': 'length', + 'points': 'points', + 'seed': 'seed' + } + + def __init__(self, length=None, points=None, seed=None): # noqa: E501 + """RoundTripRouteOptions - a model defined in Swagger""" # noqa: E501 + self._length = None + self._points = None + self._seed = None + self.discriminator = None + if length is not None: + self.length = length + if points is not None: + self.points = points + if seed is not None: + self.seed = seed + + @property + def length(self): + """Gets the length of this RoundTripRouteOptions. # noqa: E501 + + The target length of the route in `m` (note that this is a preferred value, but results may be different). # noqa: E501 + + :return: The length of this RoundTripRouteOptions. # noqa: E501 + :rtype: float + """ + return self._length + + @length.setter + def length(self, length): + """Sets the length of this RoundTripRouteOptions. + + The target length of the route in `m` (note that this is a preferred value, but results may be different). # noqa: E501 + + :param length: The length of this RoundTripRouteOptions. # noqa: E501 + :type: float + """ + + self._length = length + + @property + def points(self): + """Gets the points of this RoundTripRouteOptions. # noqa: E501 + + The number of points to use on the route. Larger values create more circular routes. # noqa: E501 + + :return: The points of this RoundTripRouteOptions. # noqa: E501 + :rtype: int + """ + return self._points + + @points.setter + def points(self, points): + """Sets the points of this RoundTripRouteOptions. + + The number of points to use on the route. Larger values create more circular routes. # noqa: E501 + + :param points: The points of this RoundTripRouteOptions. # noqa: E501 + :type: int + """ + + self._points = points + + @property + def seed(self): + """Gets the seed of this RoundTripRouteOptions. # noqa: E501 + + A seed to use for adding randomisation to the overall direction of the generated route # noqa: E501 + + :return: The seed of this RoundTripRouteOptions. # noqa: E501 + :rtype: int + """ + return self._seed + + @seed.setter + def seed(self, seed): + """Sets the seed of this RoundTripRouteOptions. + + A seed to use for adding randomisation to the overall direction of the generated route # noqa: E501 + + :param seed: The seed of this RoundTripRouteOptions. # noqa: E501 + :type: int + """ + + self._seed = seed + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RoundTripRouteOptions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RoundTripRouteOptions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/route_options.py b/openrouteservice/models/route_options.py new file mode 100644 index 00000000..0a90922e --- /dev/null +++ b/openrouteservice/models/route_options.py @@ -0,0 +1,293 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class RouteOptions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'avoid_borders': 'str', + 'avoid_countries': 'list[str]', + 'avoid_features': 'list[str]', + 'avoid_polygons': 'RouteOptionsAvoidPolygons', + 'profile_params': 'ProfileParameters', + 'round_trip': 'RoundTripRouteOptions', + 'vehicle_type': 'str' + } + + attribute_map = { + 'avoid_borders': 'avoid_borders', + 'avoid_countries': 'avoid_countries', + 'avoid_features': 'avoid_features', + 'avoid_polygons': 'avoid_polygons', + 'profile_params': 'profile_params', + 'round_trip': 'round_trip', + 'vehicle_type': 'vehicle_type' + } + + def __init__(self, avoid_borders=None, avoid_countries=None, avoid_features=None, avoid_polygons=None, profile_params=None, round_trip=None, vehicle_type='hgv'): # noqa: E501 + """RouteOptions - a model defined in Swagger""" # noqa: E501 + self._avoid_borders = None + self._avoid_countries = None + self._avoid_features = None + self._avoid_polygons = None + self._profile_params = None + self._round_trip = None + self._vehicle_type = None + self.discriminator = None + if avoid_borders is not None: + self.avoid_borders = avoid_borders + if avoid_countries is not None: + self.avoid_countries = avoid_countries + if avoid_features is not None: + self.avoid_features = avoid_features + if avoid_polygons is not None: + self.avoid_polygons = avoid_polygons + if profile_params is not None: + self.profile_params = profile_params + if round_trip is not None: + self.round_trip = round_trip + if vehicle_type is not None: + self.vehicle_type = vehicle_type + + @property + def avoid_borders(self): + """Gets the avoid_borders of this RouteOptions. # noqa: E501 + + Specify which type of border crossing to avoid # noqa: E501 + + :return: The avoid_borders of this RouteOptions. # noqa: E501 + :rtype: str + """ + return self._avoid_borders + + @avoid_borders.setter + def avoid_borders(self, avoid_borders): + """Sets the avoid_borders of this RouteOptions. + + Specify which type of border crossing to avoid # noqa: E501 + + :param avoid_borders: The avoid_borders of this RouteOptions. # noqa: E501 + :type: str + """ + allowed_values = ["all", "controlled", "none"] # noqa: E501 + if avoid_borders not in allowed_values: + raise ValueError( + "Invalid value for `avoid_borders` ({0}), must be one of {1}" # noqa: E501 + .format(avoid_borders, allowed_values) + ) + + self._avoid_borders = avoid_borders + + @property + def avoid_countries(self): + """Gets the avoid_countries of this RouteOptions. # noqa: E501 + + List of countries to exclude from matrix with `driving-*` profiles. Can be used together with `'avoid_borders': 'controlled'`. `[ 11, 193 ]` would exclude Austria and Switzerland. List of countries and application examples can be found [here](https://giscience.github.io/openrouteservice/technical-details/country-list). Also, ISO standard country codes cna be used in place of the numerical ids, for example, DE or DEU for Germany. # noqa: E501 + + :return: The avoid_countries of this RouteOptions. # noqa: E501 + :rtype: list[str] + """ + return self._avoid_countries + + @avoid_countries.setter + def avoid_countries(self, avoid_countries): + """Sets the avoid_countries of this RouteOptions. + + List of countries to exclude from matrix with `driving-*` profiles. Can be used together with `'avoid_borders': 'controlled'`. `[ 11, 193 ]` would exclude Austria and Switzerland. List of countries and application examples can be found [here](https://giscience.github.io/openrouteservice/technical-details/country-list). Also, ISO standard country codes cna be used in place of the numerical ids, for example, DE or DEU for Germany. # noqa: E501 + + :param avoid_countries: The avoid_countries of this RouteOptions. # noqa: E501 + :type: list[str] + """ + + self._avoid_countries = avoid_countries + + @property + def avoid_features(self): + """Gets the avoid_features of this RouteOptions. # noqa: E501 + + List of features to avoid. # noqa: E501 + + :return: The avoid_features of this RouteOptions. # noqa: E501 + :rtype: list[str] + """ + return self._avoid_features + + @avoid_features.setter + def avoid_features(self, avoid_features): + """Sets the avoid_features of this RouteOptions. + + List of features to avoid. # noqa: E501 + + :param avoid_features: The avoid_features of this RouteOptions. # noqa: E501 + :type: list[str] + """ + allowed_values = ["highways", "tollways", "ferries", "fords", "steps"] # noqa: E501 + if not set(avoid_features).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `avoid_features` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(avoid_features) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._avoid_features = avoid_features + + @property + def avoid_polygons(self): + """Gets the avoid_polygons of this RouteOptions. # noqa: E501 + + + :return: The avoid_polygons of this RouteOptions. # noqa: E501 + :rtype: RouteOptionsAvoidPolygons + """ + return self._avoid_polygons + + @avoid_polygons.setter + def avoid_polygons(self, avoid_polygons): + """Sets the avoid_polygons of this RouteOptions. + + + :param avoid_polygons: The avoid_polygons of this RouteOptions. # noqa: E501 + :type: RouteOptionsAvoidPolygons + """ + + self._avoid_polygons = avoid_polygons + + @property + def profile_params(self): + """Gets the profile_params of this RouteOptions. # noqa: E501 + + + :return: The profile_params of this RouteOptions. # noqa: E501 + :rtype: ProfileParameters + """ + return self._profile_params + + @profile_params.setter + def profile_params(self, profile_params): + """Sets the profile_params of this RouteOptions. + + + :param profile_params: The profile_params of this RouteOptions. # noqa: E501 + :type: ProfileParameters + """ + + self._profile_params = profile_params + + @property + def round_trip(self): + """Gets the round_trip of this RouteOptions. # noqa: E501 + + + :return: The round_trip of this RouteOptions. # noqa: E501 + :rtype: RoundTripRouteOptions + """ + return self._round_trip + + @round_trip.setter + def round_trip(self, round_trip): + """Sets the round_trip of this RouteOptions. + + + :param round_trip: The round_trip of this RouteOptions. # noqa: E501 + :type: RoundTripRouteOptions + """ + + self._round_trip = round_trip + + @property + def vehicle_type(self): + """Gets the vehicle_type of this RouteOptions. # noqa: E501 + + Definition of the vehicle type. # noqa: E501 + + :return: The vehicle_type of this RouteOptions. # noqa: E501 + :rtype: str + """ + return self._vehicle_type + + @vehicle_type.setter + def vehicle_type(self, vehicle_type): + """Sets the vehicle_type of this RouteOptions. + + Definition of the vehicle type. # noqa: E501 + + :param vehicle_type: The vehicle_type of this RouteOptions. # noqa: E501 + :type: str + """ + allowed_values = ["hgv", "bus", "agricultural", "delivery", "forestry", "goods", "unknown"] # noqa: E501 + if vehicle_type not in allowed_values: + raise ValueError( + "Invalid value for `vehicle_type` ({0}), must be one of {1}" # noqa: E501 + .format(vehicle_type, allowed_values) + ) + + self._vehicle_type = vehicle_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RouteOptions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RouteOptions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/route_options_avoid_polygons.py b/openrouteservice/models/route_options_avoid_polygons.py new file mode 100644 index 00000000..03f64419 --- /dev/null +++ b/openrouteservice/models/route_options_avoid_polygons.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class RouteOptionsAvoidPolygons(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'empty': 'bool' + } + + attribute_map = { + 'empty': 'empty' + } + + def __init__(self, empty=None): # noqa: E501 + """RouteOptionsAvoidPolygons - a model defined in Swagger""" # noqa: E501 + self._empty = None + self.discriminator = None + if empty is not None: + self.empty = empty + + @property + def empty(self): + """Gets the empty of this RouteOptionsAvoidPolygons. # noqa: E501 + + + :return: The empty of this RouteOptionsAvoidPolygons. # noqa: E501 + :rtype: bool + """ + return self._empty + + @empty.setter + def empty(self, empty): + """Sets the empty of this RouteOptionsAvoidPolygons. + + + :param empty: The empty of this RouteOptionsAvoidPolygons. # noqa: E501 + :type: bool + """ + + self._empty = empty + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RouteOptionsAvoidPolygons, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RouteOptionsAvoidPolygons): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/models/snap_profile_body.py b/openrouteservice/models/snap_profile_body.py new file mode 100644 index 00000000..99ff3327 --- /dev/null +++ b/openrouteservice/models/snap_profile_body.py @@ -0,0 +1,170 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class SnapProfileBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'locations': 'list[list[float]]', + 'radius': 'float' + } + + attribute_map = { + 'id': 'id', + 'locations': 'locations', + 'radius': 'radius' + } + + def __init__(self, id=None, locations=None, radius=None): # noqa: E501 + """SnapProfileBody - a model defined in Swagger""" # noqa: E501 + self._id = None + self._locations = None + self._radius = None + self.discriminator = None + if id is not None: + self.id = id + self.locations = locations + self.radius = radius + + @property + def id(self): + """Gets the id of this SnapProfileBody. # noqa: E501 + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :return: The id of this SnapProfileBody. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SnapProfileBody. + + Arbitrary identification string of the request reflected in the meta information. # noqa: E501 + + :param id: The id of this SnapProfileBody. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def locations(self): + """Gets the locations of this SnapProfileBody. # noqa: E501 + + The locations to be snapped as array of `longitude/latitude` pairs. # noqa: E501 + + :return: The locations of this SnapProfileBody. # noqa: E501 + :rtype: list[list[float]] + """ + return self._locations + + @locations.setter + def locations(self, locations): + """Sets the locations of this SnapProfileBody. + + The locations to be snapped as array of `longitude/latitude` pairs. # noqa: E501 + + :param locations: The locations of this SnapProfileBody. # noqa: E501 + :type: list[list[float]] + """ + if locations is None: + raise ValueError("Invalid value for `locations`, must not be `None`") # noqa: E501 + + self._locations = locations + + @property + def radius(self): + """Gets the radius of this SnapProfileBody. # noqa: E501 + + Maximum radius in meters around given coordinates to search for graph edges. # noqa: E501 + + :return: The radius of this SnapProfileBody. # noqa: E501 + :rtype: float + """ + return self._radius + + @radius.setter + def radius(self, radius): + """Sets the radius of this SnapProfileBody. + + Maximum radius in meters around given coordinates to search for graph edges. # noqa: E501 + + :param radius: The radius of this SnapProfileBody. # noqa: E501 + :type: float + """ + if radius is None: + raise ValueError("Invalid value for `radius`, must not be `None`") # noqa: E501 + + self._radius = radius + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnapProfileBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnapProfileBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/openrouteservice/rest.py b/openrouteservice/rest.py new file mode 100644 index 00000000..7ce94f4e --- /dev/null +++ b/openrouteservice/rest.py @@ -0,0 +1,317 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode + +try: + import urllib3 +except ImportError: + raise ImportError('Swagger python client requires urllib3.') + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.getheaders() + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.getheader(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if query_params: + url += '?' + urlencode(query_params) + if re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = '{}' + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message diff --git a/openrouteservice/utility.py b/openrouteservice/utility.py new file mode 100644 index 00000000..6c8fa6ba --- /dev/null +++ b/openrouteservice/utility.py @@ -0,0 +1,105 @@ +from openrouteservice.configuration import Configuration +from openrouteservice.api_client import ApiClient + +def apiClient(apiKey: str = None, host: str = None) -> ApiClient: + configuration = Configuration() + + if(apiKey): + configuration.api_key['Authorization'] = apiKey + + if(host): + configuration.host = host + + if not(host or apiKey): + raise ValueError('apiKey is required when using api.openrouteservice.org as a host. Please specify an apiKey or use a different host.') + + return ApiClient(configuration) + + +def decode_polyline(polyline, is3d=False): + """Decodes a Polyline string into a GeoJSON geometry. + :param polyline: An encoded polyline, only the geometry. + :type polyline: string + :param is3d: Specifies if geometry contains Z component. + :type is3d: boolean + :returns: GeoJSON Linestring geometry + :rtype: dict + """ + points = [] + index = lat = lng = z = 0 + + while index < len(polyline): + result = 1 + shift = 0 + while True: + b = ord(polyline[index]) - 63 - 1 + index += 1 + result += b << shift + shift += 5 + if b < 0x1F: + break + lat += (~result >> 1) if (result & 1) != 0 else (result >> 1) + + result = 1 + shift = 0 + while True: + b = ord(polyline[index]) - 63 - 1 + index += 1 + result += b << shift + shift += 5 + if b < 0x1F: + break + lng += ~(result >> 1) if (result & 1) != 0 else (result >> 1) + + if is3d: + result = 1 + shift = 0 + while True: + b = ord(polyline[index]) - 63 - 1 + index += 1 + result += b << shift + shift += 5 + if b < 0x1F: + break + if (result & 1) != 0: + z += ~(result >> 1) + else: + z += result >> 1 + + points.append( + [ + round(lng * 1e-5, 6), + round(lat * 1e-5, 6), + round(z * 1e-2, 1), + ] + ) + + else: + points.append([round(lng * 1e-5, 6), round(lat * 1e-5, 6)]) + + geojson = {u"type": u"LineString", u"coordinates": points} + + return geojson + + +def todict(obj, classkey=None): + """Converts an object to a dict + :param obj: the object to convert + """ + if isinstance(obj, dict): + data = {} + for (k, v) in obj.items(): + data[k] = todict(v, classkey) + return data + elif hasattr(obj, "to_dict"): + return obj.to_dict() + elif hasattr(obj, "__iter__") and not isinstance(obj, str): + return [todict(v, classkey) for v in obj] + elif hasattr(obj, "__dict__"): + data = dict([(key[1:] if key[0] == "_" else key, todict(getattr(obj, key), classkey)) + for key in obj.__dict__]) + if classkey is not None and hasattr(obj, "__class__"): + data[classkey] = obj.__class__.__name__ + return data + else: + return obj diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..86e711b5 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1248 @@ +{ + "name": "openrouteservice-py", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "vitepress": "^1.0.0-rc.39", + "vue": "^3.4.15" + } + }, + "node_modules/@algolia/autocomplete-core": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/autocomplete-plugin-algolia-insights": "1.9.3", + "@algolia/autocomplete-shared": "1.9.3" + } + }, + "node_modules/@algolia/autocomplete-plugin-algolia-insights": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/autocomplete-shared": "1.9.3" + }, + "peerDependencies": { + "search-insights": ">= 1 < 3" + } + }, + "node_modules/@algolia/autocomplete-preset-algolia": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/autocomplete-shared": "1.9.3" + }, + "peerDependencies": { + "@algolia/client-search": ">= 4.9.1 < 6", + "algoliasearch": ">= 4.9.1 < 6" + } + }, + "node_modules/@algolia/autocomplete-shared": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@algolia/client-search": ">= 4.9.1 < 6", + "algoliasearch": ">= 4.9.1 < 6" + } + }, + "node_modules/@algolia/cache-browser-local-storage": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/cache-common": "4.22.1" + } + }, + "node_modules/@algolia/cache-common": { + "version": "4.22.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@algolia/cache-in-memory": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/cache-common": "4.22.1" + } + }, + "node_modules/@algolia/client-account": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "4.22.1", + "@algolia/client-search": "4.22.1", + "@algolia/transporter": "4.22.1" + } + }, + "node_modules/@algolia/client-analytics": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "4.22.1", + "@algolia/client-search": "4.22.1", + "@algolia/requester-common": "4.22.1", + "@algolia/transporter": "4.22.1" + } + }, + "node_modules/@algolia/client-common": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/requester-common": "4.22.1", + "@algolia/transporter": "4.22.1" + } + }, + "node_modules/@algolia/client-personalization": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "4.22.1", + "@algolia/requester-common": "4.22.1", + "@algolia/transporter": "4.22.1" + } + }, + "node_modules/@algolia/client-search": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "4.22.1", + "@algolia/requester-common": "4.22.1", + "@algolia/transporter": "4.22.1" + } + }, + "node_modules/@algolia/logger-common": { + "version": "4.22.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@algolia/logger-console": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/logger-common": "4.22.1" + } + }, + "node_modules/@algolia/requester-browser-xhr": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/requester-common": "4.22.1" + } + }, + "node_modules/@algolia/requester-common": { + "version": "4.22.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@algolia/requester-node-http": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/requester-common": "4.22.1" + } + }, + "node_modules/@algolia/transporter": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/cache-common": "4.22.1", + "@algolia/logger-common": "4.22.1", + "@algolia/requester-common": "4.22.1" + } + }, + "node_modules/@babel/parser": { + "version": "7.23.6", + "dev": true, + "license": "MIT", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@docsearch/css": { + "version": "3.5.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@docsearch/js": { + "version": "3.5.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@docsearch/react": "3.5.2", + "preact": "^10.0.0" + } + }, + "node_modules/@docsearch/react": { + "version": "3.5.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/autocomplete-core": "1.9.3", + "@algolia/autocomplete-preset-algolia": "1.9.3", + "@docsearch/css": "3.5.2", + "algoliasearch": "^4.19.1" + }, + "peerDependencies": { + "@types/react": ">= 16.8.0 < 19.0.0", + "react": ">= 16.8.0 < 19.0.0", + "react-dom": ">= 16.8.0 < 19.0.0", + "search-insights": ">= 1 < 3" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "search-insights": { + "optional": true + } + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", + "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", + "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", + "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", + "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", + "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", + "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", + "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", + "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", + "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", + "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", + "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", + "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", + "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", + "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", + "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", + "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", + "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", + "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", + "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", + "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", + "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", + "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", + "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.9.5", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.9.5", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/linkify-it": { + "version": "3.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/markdown-it": { + "version": "13.0.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/linkify-it": "*", + "@types/mdurl": "*" + } + }, + "node_modules/@types/mdurl": { + "version": "1.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/web-bluetooth": { + "version": "0.0.20", + "dev": true, + "license": "MIT" + }, + "node_modules/@vitejs/plugin-vue": { + "version": "5.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "vite": "^5.0.0", + "vue": "^3.2.25" + } + }, + "node_modules/@vue/compiler-core": { + "version": "3.4.15", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.23.6", + "@vue/shared": "3.4.15", + "entities": "^4.5.0", + "estree-walker": "^2.0.2", + "source-map-js": "^1.0.2" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.4.15", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-core": "3.4.15", + "@vue/shared": "3.4.15" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.4.15", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.23.6", + "@vue/compiler-core": "3.4.15", + "@vue/compiler-dom": "3.4.15", + "@vue/compiler-ssr": "3.4.15", + "@vue/shared": "3.4.15", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.5", + "postcss": "^8.4.33", + "source-map-js": "^1.0.2" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.4.15", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.4.15", + "@vue/shared": "3.4.15" + } + }, + "node_modules/@vue/devtools-api": { + "version": "6.5.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@vue/reactivity": { + "version": "3.4.15", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/shared": "3.4.15" + } + }, + "node_modules/@vue/runtime-core": { + "version": "3.4.15", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.4.15", + "@vue/shared": "3.4.15" + } + }, + "node_modules/@vue/runtime-dom": { + "version": "3.4.15", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/runtime-core": "3.4.15", + "@vue/shared": "3.4.15", + "csstype": "^3.1.3" + } + }, + "node_modules/@vue/server-renderer": { + "version": "3.4.15", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-ssr": "3.4.15", + "@vue/shared": "3.4.15" + }, + "peerDependencies": { + "vue": "3.4.15" + } + }, + "node_modules/@vue/shared": { + "version": "3.4.15", + "dev": true, + "license": "MIT" + }, + "node_modules/@vueuse/core": { + "version": "10.7.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/web-bluetooth": "^0.0.20", + "@vueuse/metadata": "10.7.2", + "@vueuse/shared": "10.7.2", + "vue-demi": ">=0.14.6" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/integrations": { + "version": "10.7.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@vueuse/core": "10.7.2", + "@vueuse/shared": "10.7.2", + "vue-demi": ">=0.14.6" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "async-validator": "*", + "axios": "*", + "change-case": "*", + "drauu": "*", + "focus-trap": "*", + "fuse.js": "*", + "idb-keyval": "*", + "jwt-decode": "*", + "nprogress": "*", + "qrcode": "*", + "sortablejs": "*", + "universal-cookie": "*" + }, + "peerDependenciesMeta": { + "async-validator": { + "optional": true + }, + "axios": { + "optional": true + }, + "change-case": { + "optional": true + }, + "drauu": { + "optional": true + }, + "focus-trap": { + "optional": true + }, + "fuse.js": { + "optional": true + }, + "idb-keyval": { + "optional": true + }, + "jwt-decode": { + "optional": true + }, + "nprogress": { + "optional": true + }, + "qrcode": { + "optional": true + }, + "sortablejs": { + "optional": true + }, + "universal-cookie": { + "optional": true + } + } + }, + "node_modules/@vueuse/metadata": { + "version": "10.7.2", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/shared": { + "version": "10.7.2", + "dev": true, + "license": "MIT", + "dependencies": { + "vue-demi": ">=0.14.6" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/algoliasearch": { + "version": "4.22.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/cache-browser-local-storage": "4.22.1", + "@algolia/cache-common": "4.22.1", + "@algolia/cache-in-memory": "4.22.1", + "@algolia/client-account": "4.22.1", + "@algolia/client-analytics": "4.22.1", + "@algolia/client-common": "4.22.1", + "@algolia/client-personalization": "4.22.1", + "@algolia/client-search": "4.22.1", + "@algolia/logger-common": "4.22.1", + "@algolia/logger-console": "4.22.1", + "@algolia/requester-browser-xhr": "4.22.1", + "@algolia/requester-common": "4.22.1", + "@algolia/requester-node-http": "4.22.1", + "@algolia/transporter": "4.22.1" + } + }, + "node_modules/csstype": { + "version": "3.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/entities": { + "version": "4.5.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/esbuild": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", + "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.19.11", + "@esbuild/android-arm": "0.19.11", + "@esbuild/android-arm64": "0.19.11", + "@esbuild/android-x64": "0.19.11", + "@esbuild/darwin-arm64": "0.19.11", + "@esbuild/darwin-x64": "0.19.11", + "@esbuild/freebsd-arm64": "0.19.11", + "@esbuild/freebsd-x64": "0.19.11", + "@esbuild/linux-arm": "0.19.11", + "@esbuild/linux-arm64": "0.19.11", + "@esbuild/linux-ia32": "0.19.11", + "@esbuild/linux-loong64": "0.19.11", + "@esbuild/linux-mips64el": "0.19.11", + "@esbuild/linux-ppc64": "0.19.11", + "@esbuild/linux-riscv64": "0.19.11", + "@esbuild/linux-s390x": "0.19.11", + "@esbuild/linux-x64": "0.19.11", + "@esbuild/netbsd-x64": "0.19.11", + "@esbuild/openbsd-x64": "0.19.11", + "@esbuild/sunos-x64": "0.19.11", + "@esbuild/win32-arm64": "0.19.11", + "@esbuild/win32-ia32": "0.19.11", + "@esbuild/win32-x64": "0.19.11" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/focus-trap": { + "version": "7.5.4", + "dev": true, + "license": "MIT", + "dependencies": { + "tabbable": "^6.2.0" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/magic-string": { + "version": "0.30.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/mark.js": { + "version": "8.11.1", + "dev": true, + "license": "MIT" + }, + "node_modules/minisearch": { + "version": "6.3.0", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.7", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/postcss": { + "version": "8.4.33", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/preact": { + "version": "10.19.3", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, + "node_modules/rollup": { + "version": "4.9.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.9.5", + "@rollup/rollup-android-arm64": "4.9.5", + "@rollup/rollup-darwin-arm64": "4.9.5", + "@rollup/rollup-darwin-x64": "4.9.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.9.5", + "@rollup/rollup-linux-arm64-gnu": "4.9.5", + "@rollup/rollup-linux-arm64-musl": "4.9.5", + "@rollup/rollup-linux-riscv64-gnu": "4.9.5", + "@rollup/rollup-linux-x64-gnu": "4.9.5", + "@rollup/rollup-linux-x64-musl": "4.9.5", + "@rollup/rollup-win32-arm64-msvc": "4.9.5", + "@rollup/rollup-win32-ia32-msvc": "4.9.5", + "@rollup/rollup-win32-x64-msvc": "4.9.5", + "fsevents": "~2.3.2" + } + }, + "node_modules/search-insights": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.13.0.tgz", + "integrity": "sha512-Orrsjf9trHHxFRuo9/rzm0KIWmgzE8RMlZMzuhZOJ01Rnz3D0YBAe+V6473t6/H6c7irs6Lt48brULAiRWb3Vw==", + "dev": true, + "peer": true + }, + "node_modules/shikiji": { + "version": "0.9.19", + "dev": true, + "license": "MIT", + "dependencies": { + "shikiji-core": "0.9.19" + } + }, + "node_modules/shikiji-core": { + "version": "0.9.19", + "dev": true, + "license": "MIT" + }, + "node_modules/shikiji-transformers": { + "version": "0.9.19", + "dev": true, + "license": "MIT", + "dependencies": { + "shikiji": "0.9.19" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tabbable": { + "version": "6.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "5.0.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz", + "integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==", + "dev": true, + "dependencies": { + "esbuild": "^0.19.3", + "postcss": "^8.4.32", + "rollup": "^4.2.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vitepress": { + "version": "1.0.0-rc.39", + "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-rc.39.tgz", + "integrity": "sha512-EcgoRlAAp37WOxUOYv45oxyhLrcy3Upey+mKpqW3ldsg6Ol4trPndRBk2GO0QiSvEKlb9BMerk49D/bFICN6kg==", + "dev": true, + "dependencies": { + "@docsearch/css": "^3.5.2", + "@docsearch/js": "^3.5.2", + "@types/markdown-it": "^13.0.7", + "@vitejs/plugin-vue": "^5.0.3", + "@vue/devtools-api": "^6.5.1", + "@vueuse/core": "^10.7.2", + "@vueuse/integrations": "^10.7.2", + "focus-trap": "^7.5.4", + "mark.js": "8.11.1", + "minisearch": "^6.3.0", + "shikiji": "^0.9.19", + "shikiji-core": "^0.9.19", + "shikiji-transformers": "^0.9.19", + "vite": "^5.0.11", + "vue": "^3.4.14" + }, + "bin": { + "vitepress": "bin/vitepress.js" + }, + "peerDependencies": { + "markdown-it-mathjax3": "^4.3.2", + "postcss": "^8.4.33" + }, + "peerDependenciesMeta": { + "markdown-it-mathjax3": { + "optional": true + }, + "postcss": { + "optional": true + } + } + }, + "node_modules/vue": { + "version": "3.4.15", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.15.tgz", + "integrity": "sha512-jC0GH4KkWLWJOEQjOpkqU1bQsBwf4R1rsFtw5GQJbjHVKWDzO6P0nWWBTmjp1xSemAioDFj1jdaK1qa3DnMQoQ==", + "dev": true, + "dependencies": { + "@vue/compiler-dom": "3.4.15", + "@vue/compiler-sfc": "3.4.15", + "@vue/runtime-dom": "3.4.15", + "@vue/server-renderer": "3.4.15", + "@vue/shared": "3.4.15" + }, + "peerDependencies": { + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/vue-demi": { + "version": "0.14.6", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..cbbaa45f --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "devDependencies": { + "vitepress": "^1.0.0-rc.39", + "vue": "^3.4.15" + }, + "scripts": { + "docs:dev": "vitepress dev", + "docs:build": "vitepress build", + "docs:preview": "vitepress preview" + } +} diff --git a/poetry.lock b/poetry.lock index 3f91b19a..d181ede8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,109 +1,36 @@ -# This file is automatically @generated by Poetry 1.5.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] -name = "certifi" -version = "2023.5.7" -description = "Python package for providing Mozilla's CA Bundle." +name = "cachetools" +version = "5.3.3" +description = "Extensible memoizing collections and decorators" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "certifi-2023.5.7-py3-none-any.whl", hash = "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716"}, - {file = "certifi-2023.5.7.tar.gz", hash = "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7"}, + {file = "cachetools-5.3.3-py3-none-any.whl", hash = "sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945"}, + {file = "cachetools-5.3.3.tar.gz", hash = "sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105"}, ] [[package]] -name = "cfgv" -version = "3.3.1" -description = "Validate configuration and produce human readable error messages." +name = "certifi" +version = "2024.2.2" +description = "Python package for providing Mozilla's CA Bundle." optional = false -python-versions = ">=3.6.1" +python-versions = ">=3.6" files = [ - {file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"}, - {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, + {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, + {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, ] [[package]] -name = "charset-normalizer" -version = "3.1.0" -description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +name = "chardet" +version = "5.2.0" +description = "Universal encoding detector for Python 3" optional = false -python-versions = ">=3.7.0" +python-versions = ">=3.7" files = [ - {file = "charset-normalizer-3.1.0.tar.gz", hash = "sha256:34e0a2f9c370eb95597aae63bf85eb5e96826d81e3dcf88b8886012906f509b5"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e0ac8959c929593fee38da1c2b64ee9778733cdf03c482c9ff1d508b6b593b2b"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d7fc3fca01da18fbabe4625d64bb612b533533ed10045a2ac3dd194bfa656b60"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:04eefcee095f58eaabe6dc3cc2262f3bcd776d2c67005880894f447b3f2cb9c1"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:20064ead0717cf9a73a6d1e779b23d149b53daf971169289ed2ed43a71e8d3b0"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1435ae15108b1cb6fffbcea2af3d468683b7afed0169ad718451f8db5d1aff6f"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c84132a54c750fda57729d1e2599bb598f5fa0344085dbde5003ba429a4798c0"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75f2568b4189dda1c567339b48cba4ac7384accb9c2a7ed655cd86b04055c795"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:11d3bcb7be35e7b1bba2c23beedac81ee893ac9871d0ba79effc7fc01167db6c"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:891cf9b48776b5c61c700b55a598621fdb7b1e301a550365571e9624f270c203"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:5f008525e02908b20e04707a4f704cd286d94718f48bb33edddc7d7b584dddc1"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:b06f0d3bf045158d2fb8837c5785fe9ff9b8c93358be64461a1089f5da983137"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:49919f8400b5e49e961f320c735388ee686a62327e773fa5b3ce6721f7e785ce"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:22908891a380d50738e1f978667536f6c6b526a2064156203d418f4856d6e86a"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-win32.whl", hash = "sha256:12d1a39aa6b8c6f6248bb54550efcc1c38ce0d8096a146638fd4738e42284448"}, - {file = "charset_normalizer-3.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:65ed923f84a6844de5fd29726b888e58c62820e0769b76565480e1fdc3d062f8"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9a3267620866c9d17b959a84dd0bd2d45719b817245e49371ead79ed4f710d19"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6734e606355834f13445b6adc38b53c0fd45f1a56a9ba06c2058f86893ae8017"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f8303414c7b03f794347ad062c0516cee0e15f7a612abd0ce1e25caf6ceb47df"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aaf53a6cebad0eae578f062c7d462155eada9c172bd8c4d250b8c1d8eb7f916a"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3dc5b6a8ecfdc5748a7e429782598e4f17ef378e3e272eeb1340ea57c9109f41"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e1b25e3ad6c909f398df8921780d6a3d120d8c09466720226fc621605b6f92b1"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0ca564606d2caafb0abe6d1b5311c2649e8071eb241b2d64e75a0d0065107e62"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b82fab78e0b1329e183a65260581de4375f619167478dddab510c6c6fb04d9b6"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bd7163182133c0c7701b25e604cf1611c0d87712e56e88e7ee5d72deab3e76b5"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:11d117e6c63e8f495412d37e7dc2e2fff09c34b2d09dbe2bee3c6229577818be"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:cf6511efa4801b9b38dc5546d7547d5b5c6ef4b081c60b23e4d941d0eba9cbeb"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:abc1185d79f47c0a7aaf7e2412a0eb2c03b724581139193d2d82b3ad8cbb00ac"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:cb7b2ab0188829593b9de646545175547a70d9a6e2b63bf2cd87a0a391599324"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-win32.whl", hash = "sha256:c36bcbc0d5174a80d6cccf43a0ecaca44e81d25be4b7f90f0ed7bcfbb5a00909"}, - {file = "charset_normalizer-3.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:cca4def576f47a09a943666b8f829606bcb17e2bc2d5911a46c8f8da45f56755"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0c95f12b74681e9ae127728f7e5409cbbef9cd914d5896ef238cc779b8152373"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fca62a8301b605b954ad2e9c3666f9d97f63872aa4efcae5492baca2056b74ab"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ac0aa6cd53ab9a31d397f8303f92c42f534693528fafbdb997c82bae6e477ad9"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c3af8e0f07399d3176b179f2e2634c3ce9c1301379a6b8c9c9aeecd481da494f"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a5fc78f9e3f501a1614a98f7c54d3969f3ad9bba8ba3d9b438c3bc5d047dd28"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:628c985afb2c7d27a4800bfb609e03985aaecb42f955049957814e0491d4006d"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:74db0052d985cf37fa111828d0dd230776ac99c740e1a758ad99094be4f1803d"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1e8fcdd8f672a1c4fc8d0bd3a2b576b152d2a349782d1eb0f6b8e52e9954731d"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:04afa6387e2b282cf78ff3dbce20f0cc071c12dc8f685bd40960cc68644cfea6"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:dd5653e67b149503c68c4018bf07e42eeed6b4e956b24c00ccdf93ac79cdff84"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d2686f91611f9e17f4548dbf050e75b079bbc2a82be565832bc8ea9047b61c8c"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-win32.whl", hash = "sha256:4155b51ae05ed47199dc5b2a4e62abccb274cee6b01da5b895099b61b1982974"}, - {file = "charset_normalizer-3.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:322102cdf1ab682ecc7d9b1c5eed4ec59657a65e1c146a0da342b78f4112db23"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e633940f28c1e913615fd624fcdd72fdba807bf53ea6925d6a588e84e1151531"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3a06f32c9634a8705f4ca9946d667609f52cf130d5548881401f1eb2c39b1e2c"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7381c66e0561c5757ffe616af869b916c8b4e42b367ab29fedc98481d1e74e14"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3573d376454d956553c356df45bb824262c397c6e26ce43e8203c4c540ee0acb"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e89df2958e5159b811af9ff0f92614dabf4ff617c03a4c1c6ff53bf1c399e0e1"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:78cacd03e79d009d95635e7d6ff12c21eb89b894c354bd2b2ed0b4763373693b"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:de5695a6f1d8340b12a5d6d4484290ee74d61e467c39ff03b39e30df62cf83a0"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1c60b9c202d00052183c9be85e5eaf18a4ada0a47d188a83c8f5c5b23252f649"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f645caaf0008bacf349875a974220f1f1da349c5dbe7c4ec93048cdc785a3326"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ea9f9c6034ea2d93d9147818f17c2a0860d41b71c38b9ce4d55f21b6f9165a11"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:80d1543d58bd3d6c271b66abf454d437a438dff01c3e62fdbcd68f2a11310d4b"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:73dc03a6a7e30b7edc5b01b601e53e7fc924b04e1835e8e407c12c037e81adbd"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6f5c2e7bc8a4bf7c426599765b1bd33217ec84023033672c1e9a8b35eaeaaaf8"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-win32.whl", hash = "sha256:12a2b561af122e3d94cdb97fe6fb2bb2b82cef0cdca131646fdb940a1eda04f0"}, - {file = "charset_normalizer-3.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:3160a0fd9754aab7d47f95a6b63ab355388d890163eb03b2d2b87ab0a30cfa59"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:38e812a197bf8e71a59fe55b757a84c1f946d0ac114acafaafaf21667a7e169e"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6baf0baf0d5d265fa7944feb9f7451cc316bfe30e8df1a61b1bb08577c554f31"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8f25e17ab3039b05f762b0a55ae0b3632b2e073d9c8fc88e89aca31a6198e88f"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3747443b6a904001473370d7810aa19c3a180ccd52a7157aacc264a5ac79265e"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b116502087ce8a6b7a5f1814568ccbd0e9f6cfd99948aa59b0e241dc57cf739f"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d16fd5252f883eb074ca55cb622bc0bee49b979ae4e8639fff6ca3ff44f9f854"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21fa558996782fc226b529fdd2ed7866c2c6ec91cee82735c98a197fae39f706"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6f6c7a8a57e9405cad7485f4c9d3172ae486cfef1344b5ddd8e5239582d7355e"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ac3775e3311661d4adace3697a52ac0bab17edd166087d493b52d4f4f553f9f0"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:10c93628d7497c81686e8e5e557aafa78f230cd9e77dd0c40032ef90c18f2230"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:6f4f4668e1831850ebcc2fd0b1cd11721947b6dc7c00bf1c6bd3c929ae14f2c7"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:0be65ccf618c1e7ac9b849c315cc2e8a8751d9cfdaa43027d4f6624bd587ab7e"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:53d0a3fa5f8af98a1e261de6a3943ca631c526635eb5817a87a59d9a57ebf48f"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-win32.whl", hash = "sha256:a04f86f41a8916fe45ac5024ec477f41f886b3c435da2d4e3d2709b22ab02af1"}, - {file = "charset_normalizer-3.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:830d2948a5ec37c386d3170c483063798d7879037492540f10a475e3fd6f244b"}, - {file = "charset_normalizer-3.1.0-py3-none-any.whl", hash = "sha256:3d9098b479e78c85080c98e1e35ff40b4a31d8953102bb0fd7d1b6f8a2111a3d"}, + {file = "chardet-5.2.0-py3-none-any.whl", hash = "sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970"}, + {file = "chardet-5.2.0.tar.gz", hash = "sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7"}, ] [[package]] @@ -119,71 +46,63 @@ files = [ [[package]] name = "coverage" -version = "7.2.7" +version = "7.4.4" description = "Code coverage measurement for Python" optional = false -python-versions = ">=3.7" -files = [ - {file = "coverage-7.2.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d39b5b4f2a66ccae8b7263ac3c8170994b65266797fb96cbbfd3fb5b23921db8"}, - {file = "coverage-7.2.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6d040ef7c9859bb11dfeb056ff5b3872436e3b5e401817d87a31e1750b9ae2fb"}, - {file = "coverage-7.2.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ba90a9563ba44a72fda2e85302c3abc71c5589cea608ca16c22b9804262aaeb6"}, - {file = "coverage-7.2.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7d9405291c6928619403db1d10bd07888888ec1abcbd9748fdaa971d7d661b2"}, - {file = "coverage-7.2.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31563e97dae5598556600466ad9beea39fb04e0229e61c12eaa206e0aa202063"}, - {file = "coverage-7.2.7-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:ebba1cd308ef115925421d3e6a586e655ca5a77b5bf41e02eb0e4562a111f2d1"}, - {file = "coverage-7.2.7-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:cb017fd1b2603ef59e374ba2063f593abe0fc45f2ad9abdde5b4d83bd922a353"}, - {file = "coverage-7.2.7-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d62a5c7dad11015c66fbb9d881bc4caa5b12f16292f857842d9d1871595f4495"}, - {file = "coverage-7.2.7-cp310-cp310-win32.whl", hash = "sha256:ee57190f24fba796e36bb6d3aa8a8783c643d8fa9760c89f7a98ab5455fbf818"}, - {file = "coverage-7.2.7-cp310-cp310-win_amd64.whl", hash = "sha256:f75f7168ab25dd93110c8a8117a22450c19976afbc44234cbf71481094c1b850"}, - {file = "coverage-7.2.7-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:06a9a2be0b5b576c3f18f1a241f0473575c4a26021b52b2a85263a00f034d51f"}, - {file = "coverage-7.2.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5baa06420f837184130752b7c5ea0808762083bf3487b5038d68b012e5937dbe"}, - {file = "coverage-7.2.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fdec9e8cbf13a5bf63290fc6013d216a4c7232efb51548594ca3631a7f13c3a3"}, - {file = "coverage-7.2.7-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:52edc1a60c0d34afa421c9c37078817b2e67a392cab17d97283b64c5833f427f"}, - {file = "coverage-7.2.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:63426706118b7f5cf6bb6c895dc215d8a418d5952544042c8a2d9fe87fcf09cb"}, - {file = "coverage-7.2.7-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:afb17f84d56068a7c29f5fa37bfd38d5aba69e3304af08ee94da8ed5b0865833"}, - {file = "coverage-7.2.7-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:48c19d2159d433ccc99e729ceae7d5293fbffa0bdb94952d3579983d1c8c9d97"}, - {file = "coverage-7.2.7-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0e1f928eaf5469c11e886fe0885ad2bf1ec606434e79842a879277895a50942a"}, - {file = "coverage-7.2.7-cp311-cp311-win32.whl", hash = "sha256:33d6d3ea29d5b3a1a632b3c4e4f4ecae24ef170b0b9ee493883f2df10039959a"}, - {file = "coverage-7.2.7-cp311-cp311-win_amd64.whl", hash = "sha256:5b7540161790b2f28143191f5f8ec02fb132660ff175b7747b95dcb77ac26562"}, - {file = "coverage-7.2.7-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f2f67fe12b22cd130d34d0ef79206061bfb5eda52feb6ce0dba0644e20a03cf4"}, - {file = "coverage-7.2.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a342242fe22407f3c17f4b499276a02b01e80f861f1682ad1d95b04018e0c0d4"}, - {file = "coverage-7.2.7-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:171717c7cb6b453aebac9a2ef603699da237f341b38eebfee9be75d27dc38e01"}, - {file = "coverage-7.2.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49969a9f7ffa086d973d91cec8d2e31080436ef0fb4a359cae927e742abfaaa6"}, - {file = "coverage-7.2.7-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b46517c02ccd08092f4fa99f24c3b83d8f92f739b4657b0f146246a0ca6a831d"}, - {file = "coverage-7.2.7-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:a3d33a6b3eae87ceaefa91ffdc130b5e8536182cd6dfdbfc1aa56b46ff8c86de"}, - {file = "coverage-7.2.7-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:976b9c42fb2a43ebf304fa7d4a310e5f16cc99992f33eced91ef6f908bd8f33d"}, - {file = "coverage-7.2.7-cp312-cp312-win32.whl", hash = "sha256:8de8bb0e5ad103888d65abef8bca41ab93721647590a3f740100cd65c3b00511"}, - {file = "coverage-7.2.7-cp312-cp312-win_amd64.whl", hash = "sha256:9e31cb64d7de6b6f09702bb27c02d1904b3aebfca610c12772452c4e6c21a0d3"}, - {file = "coverage-7.2.7-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:58c2ccc2f00ecb51253cbe5d8d7122a34590fac9646a960d1430d5b15321d95f"}, - {file = "coverage-7.2.7-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d22656368f0e6189e24722214ed8d66b8022db19d182927b9a248a2a8a2f67eb"}, - {file = "coverage-7.2.7-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a895fcc7b15c3fc72beb43cdcbdf0ddb7d2ebc959edac9cef390b0d14f39f8a9"}, - {file = "coverage-7.2.7-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e84606b74eb7de6ff581a7915e2dab7a28a0517fbe1c9239eb227e1354064dcd"}, - {file = "coverage-7.2.7-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:0a5f9e1dbd7fbe30196578ca36f3fba75376fb99888c395c5880b355e2875f8a"}, - {file = "coverage-7.2.7-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:419bfd2caae268623dd469eff96d510a920c90928b60f2073d79f8fe2bbc5959"}, - {file = "coverage-7.2.7-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:2aee274c46590717f38ae5e4650988d1af340fe06167546cc32fe2f58ed05b02"}, - {file = "coverage-7.2.7-cp37-cp37m-win32.whl", hash = "sha256:61b9a528fb348373c433e8966535074b802c7a5d7f23c4f421e6c6e2f1697a6f"}, - {file = "coverage-7.2.7-cp37-cp37m-win_amd64.whl", hash = "sha256:b1c546aca0ca4d028901d825015dc8e4d56aac4b541877690eb76490f1dc8ed0"}, - {file = "coverage-7.2.7-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:54b896376ab563bd38453cecb813c295cf347cf5906e8b41d340b0321a5433e5"}, - {file = "coverage-7.2.7-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3d376df58cc111dc8e21e3b6e24606b5bb5dee6024f46a5abca99124b2229ef5"}, - {file = "coverage-7.2.7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5e330fc79bd7207e46c7d7fd2bb4af2963f5f635703925543a70b99574b0fea9"}, - {file = "coverage-7.2.7-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e9d683426464e4a252bf70c3498756055016f99ddaec3774bf368e76bbe02b6"}, - {file = "coverage-7.2.7-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d13c64ee2d33eccf7437961b6ea7ad8673e2be040b4f7fd4fd4d4d28d9ccb1e"}, - {file = "coverage-7.2.7-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b7aa5f8a41217360e600da646004f878250a0d6738bcdc11a0a39928d7dc2050"}, - {file = "coverage-7.2.7-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:8fa03bce9bfbeeef9f3b160a8bed39a221d82308b4152b27d82d8daa7041fee5"}, - {file = "coverage-7.2.7-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:245167dd26180ab4c91d5e1496a30be4cd721a5cf2abf52974f965f10f11419f"}, - {file = "coverage-7.2.7-cp38-cp38-win32.whl", hash = "sha256:d2c2db7fd82e9b72937969bceac4d6ca89660db0a0967614ce2481e81a0b771e"}, - {file = "coverage-7.2.7-cp38-cp38-win_amd64.whl", hash = "sha256:2e07b54284e381531c87f785f613b833569c14ecacdcb85d56b25c4622c16c3c"}, - {file = "coverage-7.2.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:537891ae8ce59ef63d0123f7ac9e2ae0fc8b72c7ccbe5296fec45fd68967b6c9"}, - {file = "coverage-7.2.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:06fb182e69f33f6cd1d39a6c597294cff3143554b64b9825d1dc69d18cc2fff2"}, - {file = "coverage-7.2.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:201e7389591af40950a6480bd9edfa8ed04346ff80002cec1a66cac4549c1ad7"}, - {file = "coverage-7.2.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f6951407391b639504e3b3be51b7ba5f3528adbf1a8ac3302b687ecababf929e"}, - {file = "coverage-7.2.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f48351d66575f535669306aa7d6d6f71bc43372473b54a832222803eb956fd1"}, - {file = "coverage-7.2.7-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b29019c76039dc3c0fd815c41392a044ce555d9bcdd38b0fb60fb4cd8e475ba9"}, - {file = "coverage-7.2.7-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:81c13a1fc7468c40f13420732805a4c38a105d89848b7c10af65a90beff25250"}, - {file = "coverage-7.2.7-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:975d70ab7e3c80a3fe86001d8751f6778905ec723f5b110aed1e450da9d4b7f2"}, - {file = "coverage-7.2.7-cp39-cp39-win32.whl", hash = "sha256:7ee7d9d4822c8acc74a5e26c50604dff824710bc8de424904c0982e25c39c6cb"}, - {file = "coverage-7.2.7-cp39-cp39-win_amd64.whl", hash = "sha256:eb393e5ebc85245347950143969b241d08b52b88a3dc39479822e073a1a8eb27"}, - {file = "coverage-7.2.7-pp37.pp38.pp39-none-any.whl", hash = "sha256:b7b4c971f05e6ae490fef852c218b0e79d4e52f79ef0c8475566584a8fb3e01d"}, - {file = "coverage-7.2.7.tar.gz", hash = "sha256:924d94291ca674905fe9481f12294eb11f2d3d3fd1adb20314ba89e94f44ed59"}, +python-versions = ">=3.8" +files = [ + {file = "coverage-7.4.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e0be5efd5127542ef31f165de269f77560d6cdef525fffa446de6f7e9186cfb2"}, + {file = "coverage-7.4.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ccd341521be3d1b3daeb41960ae94a5e87abe2f46f17224ba5d6f2b8398016cf"}, + {file = "coverage-7.4.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:09fa497a8ab37784fbb20ab699c246053ac294d13fc7eb40ec007a5043ec91f8"}, + {file = "coverage-7.4.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b1a93009cb80730c9bca5d6d4665494b725b6e8e157c1cb7f2db5b4b122ea562"}, + {file = "coverage-7.4.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:690db6517f09336559dc0b5f55342df62370a48f5469fabf502db2c6d1cffcd2"}, + {file = "coverage-7.4.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:09c3255458533cb76ef55da8cc49ffab9e33f083739c8bd4f58e79fecfe288f7"}, + {file = "coverage-7.4.4-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:8ce1415194b4a6bd0cdcc3a1dfbf58b63f910dcb7330fe15bdff542c56949f87"}, + {file = "coverage-7.4.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b91cbc4b195444e7e258ba27ac33769c41b94967919f10037e6355e998af255c"}, + {file = "coverage-7.4.4-cp310-cp310-win32.whl", hash = "sha256:598825b51b81c808cb6f078dcb972f96af96b078faa47af7dfcdf282835baa8d"}, + {file = "coverage-7.4.4-cp310-cp310-win_amd64.whl", hash = "sha256:09ef9199ed6653989ebbcaacc9b62b514bb63ea2f90256e71fea3ed74bd8ff6f"}, + {file = "coverage-7.4.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0f9f50e7ef2a71e2fae92774c99170eb8304e3fdf9c8c3c7ae9bab3e7229c5cf"}, + {file = "coverage-7.4.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:623512f8ba53c422fcfb2ce68362c97945095b864cda94a92edbaf5994201083"}, + {file = "coverage-7.4.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0513b9508b93da4e1716744ef6ebc507aff016ba115ffe8ecff744d1322a7b63"}, + {file = "coverage-7.4.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40209e141059b9370a2657c9b15607815359ab3ef9918f0196b6fccce8d3230f"}, + {file = "coverage-7.4.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8a2b2b78c78293782fd3767d53e6474582f62443d0504b1554370bde86cc8227"}, + {file = "coverage-7.4.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:73bfb9c09951125d06ee473bed216e2c3742f530fc5acc1383883125de76d9cd"}, + {file = "coverage-7.4.4-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:1f384c3cc76aeedce208643697fb3e8437604b512255de6d18dae3f27655a384"}, + {file = "coverage-7.4.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:54eb8d1bf7cacfbf2a3186019bcf01d11c666bd495ed18717162f7eb1e9dd00b"}, + {file = "coverage-7.4.4-cp311-cp311-win32.whl", hash = "sha256:cac99918c7bba15302a2d81f0312c08054a3359eaa1929c7e4b26ebe41e9b286"}, + {file = "coverage-7.4.4-cp311-cp311-win_amd64.whl", hash = "sha256:b14706df8b2de49869ae03a5ccbc211f4041750cd4a66f698df89d44f4bd30ec"}, + {file = "coverage-7.4.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:201bef2eea65e0e9c56343115ba3814e896afe6d36ffd37bab783261db430f76"}, + {file = "coverage-7.4.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:41c9c5f3de16b903b610d09650e5e27adbfa7f500302718c9ffd1c12cf9d6818"}, + {file = "coverage-7.4.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d898fe162d26929b5960e4e138651f7427048e72c853607f2b200909794ed978"}, + {file = "coverage-7.4.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3ea79bb50e805cd6ac058dfa3b5c8f6c040cb87fe83de10845857f5535d1db70"}, + {file = "coverage-7.4.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ce4b94265ca988c3f8e479e741693d143026632672e3ff924f25fab50518dd51"}, + {file = "coverage-7.4.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:00838a35b882694afda09f85e469c96367daa3f3f2b097d846a7216993d37f4c"}, + {file = "coverage-7.4.4-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:fdfafb32984684eb03c2d83e1e51f64f0906b11e64482df3c5db936ce3839d48"}, + {file = "coverage-7.4.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:69eb372f7e2ece89f14751fbcbe470295d73ed41ecd37ca36ed2eb47512a6ab9"}, + {file = "coverage-7.4.4-cp312-cp312-win32.whl", hash = "sha256:137eb07173141545e07403cca94ab625cc1cc6bc4c1e97b6e3846270e7e1fea0"}, + {file = "coverage-7.4.4-cp312-cp312-win_amd64.whl", hash = "sha256:d71eec7d83298f1af3326ce0ff1d0ea83c7cb98f72b577097f9083b20bdaf05e"}, + {file = "coverage-7.4.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d5ae728ff3b5401cc320d792866987e7e7e880e6ebd24433b70a33b643bb0384"}, + {file = "coverage-7.4.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:cc4f1358cb0c78edef3ed237ef2c86056206bb8d9140e73b6b89fbcfcbdd40e1"}, + {file = "coverage-7.4.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8130a2aa2acb8788e0b56938786c33c7c98562697bf9f4c7d6e8e5e3a0501e4a"}, + {file = "coverage-7.4.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf271892d13e43bc2b51e6908ec9a6a5094a4df1d8af0bfc360088ee6c684409"}, + {file = "coverage-7.4.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a4cdc86d54b5da0df6d3d3a2f0b710949286094c3a6700c21e9015932b81447e"}, + {file = "coverage-7.4.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:ae71e7ddb7a413dd60052e90528f2f65270aad4b509563af6d03d53e979feafd"}, + {file = "coverage-7.4.4-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:38dd60d7bf242c4ed5b38e094baf6401faa114fc09e9e6632374388a404f98e7"}, + {file = "coverage-7.4.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:aa5b1c1bfc28384f1f53b69a023d789f72b2e0ab1b3787aae16992a7ca21056c"}, + {file = "coverage-7.4.4-cp38-cp38-win32.whl", hash = "sha256:dfa8fe35a0bb90382837b238fff375de15f0dcdb9ae68ff85f7a63649c98527e"}, + {file = "coverage-7.4.4-cp38-cp38-win_amd64.whl", hash = "sha256:b2991665420a803495e0b90a79233c1433d6ed77ef282e8e152a324bbbc5e0c8"}, + {file = "coverage-7.4.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3b799445b9f7ee8bf299cfaed6f5b226c0037b74886a4e11515e569b36fe310d"}, + {file = "coverage-7.4.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b4d33f418f46362995f1e9d4f3a35a1b6322cb959c31d88ae56b0298e1c22357"}, + {file = "coverage-7.4.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aadacf9a2f407a4688d700e4ebab33a7e2e408f2ca04dbf4aef17585389eff3e"}, + {file = "coverage-7.4.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7c95949560050d04d46b919301826525597f07b33beba6187d04fa64d47ac82e"}, + {file = "coverage-7.4.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff7687ca3d7028d8a5f0ebae95a6e4827c5616b31a4ee1192bdfde697db110d4"}, + {file = "coverage-7.4.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:5fc1de20b2d4a061b3df27ab9b7c7111e9a710f10dc2b84d33a4ab25065994ec"}, + {file = "coverage-7.4.4-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:c74880fc64d4958159fbd537a091d2a585448a8f8508bf248d72112723974cbd"}, + {file = "coverage-7.4.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:742a76a12aa45b44d236815d282b03cfb1de3b4323f3e4ec933acfae08e54ade"}, + {file = "coverage-7.4.4-cp39-cp39-win32.whl", hash = "sha256:d89d7b2974cae412400e88f35d86af72208e1ede1a541954af5d944a8ba46c57"}, + {file = "coverage-7.4.4-cp39-cp39-win_amd64.whl", hash = "sha256:9ca28a302acb19b6af89e90f33ee3e1906961f94b54ea37de6737b7ca9d8827c"}, + {file = "coverage-7.4.4-pp38.pp39.pp310-none-any.whl", hash = "sha256:b2c5edc4ac10a7ef6605a966c58929ec6c1bd0917fb8c15cb3363f65aa40e677"}, + {file = "coverage-7.4.4.tar.gz", hash = "sha256:c901df83d097649e257e803be22592aedfd5182f07b3cc87d640bbb9afd50f49"}, ] [package.dependencies] @@ -194,24 +113,24 @@ toml = ["tomli"] [[package]] name = "distlib" -version = "0.3.6" +version = "0.3.8" description = "Distribution utilities" optional = false python-versions = "*" files = [ - {file = "distlib-0.3.6-py2.py3-none-any.whl", hash = "sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e"}, - {file = "distlib-0.3.6.tar.gz", hash = "sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"}, + {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"}, + {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, ] [[package]] name = "exceptiongroup" -version = "1.1.1" +version = "1.2.0" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.1.1-py3-none-any.whl", hash = "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"}, - {file = "exceptiongroup-1.1.1.tar.gz", hash = "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"}, + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, ] [package.extras] @@ -219,77 +138,33 @@ test = ["pytest (>=6)"] [[package]] name = "execnet" -version = "1.9.0" +version = "2.0.2" description = "execnet: rapid multi-Python deployment" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=3.7" files = [ - {file = "execnet-1.9.0-py2.py3-none-any.whl", hash = "sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142"}, - {file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"}, + {file = "execnet-2.0.2-py3-none-any.whl", hash = "sha256:88256416ae766bc9e8895c76a87928c0012183da3cc4fc18016e6f050e025f41"}, + {file = "execnet-2.0.2.tar.gz", hash = "sha256:cc59bc4423742fd71ad227122eb0dd44db51efb3dc4095b45ac9a08c770096af"}, ] [package.extras] -testing = ["pre-commit"] +testing = ["hatch", "pre-commit", "pytest", "tox"] [[package]] name = "filelock" -version = "3.12.0" +version = "3.13.1" description = "A platform independent file lock." optional = false -python-versions = ">=3.7" -files = [ - {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, - {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, -] - -[package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] - -[[package]] -name = "identify" -version = "2.5.24" -description = "File identification library for Python" -optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "identify-2.5.24-py2.py3-none-any.whl", hash = "sha256:986dbfb38b1140e763e413e6feb44cd731faf72d1909543178aa79b0e258265d"}, - {file = "identify-2.5.24.tar.gz", hash = "sha256:0aac67d5b4812498056d28a9a512a483f5085cc28640b02b258a59dac34301d4"}, + {file = "filelock-3.13.1-py3-none-any.whl", hash = "sha256:57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c"}, + {file = "filelock-3.13.1.tar.gz", hash = "sha256:521f5f56c50f8426f5e03ad3b281b490a87ef15bc6c526f168290f0c7148d44e"}, ] [package.extras] -license = ["ukkonen"] - -[[package]] -name = "idna" -version = "3.4" -description = "Internationalized Domain Names in Applications (IDNA)" -optional = false -python-versions = ">=3.5" -files = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, -] - -[[package]] -name = "importlib-metadata" -version = "6.6.0" -description = "Read metadata from Python packages" -optional = false -python-versions = ">=3.7" -files = [ - {file = "importlib_metadata-6.6.0-py3-none-any.whl", hash = "sha256:43dd286a2cd8995d5eaef7fee2066340423b818ed3fd70adf0bad5f1fac53fed"}, - {file = "importlib_metadata-6.6.0.tar.gz", hash = "sha256:92501cdf9cc66ebd3e612f1b4f0c0765dfa42f0fa38ffb319b6bd84dd675d705"}, -] - -[package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} -zipp = ">=0.5" - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -perf = ["ipython"] -testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"] +docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.24)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"] +typing = ["typing-extensions (>=4.8)"] [[package]] name = "iniconfig" @@ -302,134 +177,98 @@ files = [ {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] -[[package]] -name = "nodeenv" -version = "1.8.0" -description = "Node.js virtual environment builder" -optional = false -python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" -files = [ - {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, - {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, -] - -[package.dependencies] -setuptools = "*" - [[package]] name = "packaging" -version = "23.1" +version = "24.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.7" files = [ - {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, - {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, + {file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"}, + {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, ] [[package]] name = "platformdirs" -version = "3.5.1" +version = "4.2.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"}, - {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, + {file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"}, + {file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"}, ] -[package.dependencies] -typing-extensions = {version = ">=4.5", markers = "python_version < \"3.8\""} - [package.extras] -docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] [[package]] name = "pluggy" -version = "1.0.0" +version = "1.4.0" description = "plugin and hook calling mechanisms for python" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, - {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, ] -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] [[package]] -name = "poetry-semver" -version = "0.1.0" -description = "A semantic versioning library for Python" +name = "py" +version = "1.11.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ - {file = "poetry-semver-0.1.0.tar.gz", hash = "sha256:d809b612aa27b39bf2d0fc9d31b4f4809b0e972646c5f19cfa46c725b7638810"}, - {file = "poetry_semver-0.1.0-py2.py3-none-any.whl", hash = "sha256:4e6349bd7231cc657f0e1930f7b204e87e33dfd63eef5cac869363969515083a"}, + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, ] [[package]] -name = "poetry2conda" -version = "0.3.0" -description = "Convert pyproject.toml to environment.yaml" +name = "pyproject-api" +version = "1.6.1" +description = "API to interact with the python pyproject.toml based projects" optional = false -python-versions = ">=3.6,<4.0" +python-versions = ">=3.8" files = [ - {file = "poetry2conda-0.3.0-py3-none-any.whl", hash = "sha256:218618d37331bd6d3d3007edcf21d71802990a0ce9c27e8bb23f739cfa82ed03"}, - {file = "poetry2conda-0.3.0.tar.gz", hash = "sha256:574b6295ff877ff8fb56fe2034160ff9ee9db55a3f3c2faec65458e69125491b"}, + {file = "pyproject_api-1.6.1-py3-none-any.whl", hash = "sha256:4c0116d60476b0786c88692cf4e325a9814965e2469c5998b830bba16b183675"}, + {file = "pyproject_api-1.6.1.tar.gz", hash = "sha256:1817dc018adc0d1ff9ca1ed8c60e1623d5aaca40814b953af14a9cf9a5cae538"}, ] [package.dependencies] -poetry-semver = ">=0.1.0,<0.2.0" -toml = ">=0.10.0,<0.11.0" - -[[package]] -name = "pre-commit" -version = "2.21.0" -description = "A framework for managing and maintaining multi-language pre-commit hooks." -optional = false -python-versions = ">=3.7" -files = [ - {file = "pre_commit-2.21.0-py2.py3-none-any.whl", hash = "sha256:e2f91727039fc39a92f58a588a25b87f936de6567eed4f0e673e0507edc75bad"}, - {file = "pre_commit-2.21.0.tar.gz", hash = "sha256:31ef31af7e474a8d8995027fefdfcf509b5c913ff31f2015b4ec4beb26a6f658"}, -] +packaging = ">=23.1" +tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} -[package.dependencies] -cfgv = ">=2.0.0" -identify = ">=1.0.0" -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} -nodeenv = ">=0.11.1" -pyyaml = ">=5.1" -virtualenv = ">=20.10.0" +[package.extras] +docs = ["furo (>=2023.8.19)", "sphinx (<7.2)", "sphinx-autodoc-typehints (>=1.24)"] +testing = ["covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)", "setuptools (>=68.1.2)", "wheel (>=0.41.2)"] [[package]] name = "pytest" -version = "7.3.1" +version = "8.1.1" description = "pytest: simple powerful testing with Python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pytest-7.3.1-py3-none-any.whl", hash = "sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362"}, - {file = "pytest-7.3.1.tar.gz", hash = "sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3"}, + {file = "pytest-8.1.1-py3-none-any.whl", hash = "sha256:2a8386cfc11fa9d2c50ee7b2a57e7d898ef90470a7a34c4b949ff59662bb78b7"}, + {file = "pytest-8.1.1.tar.gz", hash = "sha256:ac978141a75948948817d360297b7aae0fcb9d6ff6bc9ec6d514b85d5a65c044"}, ] [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} +pluggy = ">=1.4,<2.0" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] +testing = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pytest-cov" @@ -451,13 +290,13 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtuale [[package]] name = "pytest-xdist" -version = "3.3.1" +version = "3.5.0" description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" optional = false python-versions = ">=3.7" files = [ - {file = "pytest-xdist-3.3.1.tar.gz", hash = "sha256:d5ee0520eb1b7bcca50a60a518ab7a7707992812c578198f8b44fdfac78e8c93"}, - {file = "pytest_xdist-3.3.1-py3-none-any.whl", hash = "sha256:ff9daa7793569e6a68544850fd3927cd257cc03a7ef76c95e86915355e82b5f2"}, + {file = "pytest-xdist-3.5.0.tar.gz", hash = "sha256:cbb36f3d67e0c478baa57fa4edc8843887e0f6cfc42d677530a36d7472b32d8a"}, + {file = "pytest_xdist-3.5.0-py3-none-any.whl", hash = "sha256:d075629c7e00b611df89f490a5063944bee7a4362a5ff11c7cc7824a03dfce24"}, ] [package.dependencies] @@ -470,121 +309,39 @@ setproctitle = ["setproctitle"] testing = ["filelock"] [[package]] -name = "pyyaml" -version = "6.0" -description = "YAML parser and emitter for Python" -optional = false -python-versions = ">=3.6" -files = [ - {file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"}, - {file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"}, - {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"}, - {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b"}, - {file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"}, - {file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"}, - {file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"}, - {file = "PyYAML-6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358"}, - {file = "PyYAML-6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1"}, - {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d"}, - {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f"}, - {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782"}, - {file = "PyYAML-6.0-cp311-cp311-win32.whl", hash = "sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7"}, - {file = "PyYAML-6.0-cp311-cp311-win_amd64.whl", hash = "sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf"}, - {file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"}, - {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"}, - {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"}, - {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4"}, - {file = "PyYAML-6.0-cp36-cp36m-win32.whl", hash = "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293"}, - {file = "PyYAML-6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57"}, - {file = "PyYAML-6.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c"}, - {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0"}, - {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4"}, - {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9"}, - {file = "PyYAML-6.0-cp37-cp37m-win32.whl", hash = "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737"}, - {file = "PyYAML-6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d"}, - {file = "PyYAML-6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b"}, - {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba"}, - {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34"}, - {file = "PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287"}, - {file = "PyYAML-6.0-cp38-cp38-win32.whl", hash = "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78"}, - {file = "PyYAML-6.0-cp38-cp38-win_amd64.whl", hash = "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07"}, - {file = "PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b"}, - {file = "PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174"}, - {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803"}, - {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3"}, - {file = "PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0"}, - {file = "PyYAML-6.0-cp39-cp39-win32.whl", hash = "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb"}, - {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"}, - {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, -] - -[[package]] -name = "requests" -version = "2.31.0" -description = "Python HTTP for Humans." -optional = false -python-versions = ">=3.7" -files = [ - {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, - {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, -] - -[package.dependencies] -certifi = ">=2017.4.17" -charset-normalizer = ">=2,<4" -idna = ">=2.5,<4" -urllib3 = ">=1.21.1,<3" - -[package.extras] -socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] - -[[package]] -name = "responses" -version = "0.23.1" -description = "A utility library for mocking out the `requests` Python library." +name = "python-dateutil" +version = "2.9.0.post0" +description = "Extensions to the standard Python datetime module" optional = false -python-versions = ">=3.7" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ - {file = "responses-0.23.1-py3-none-any.whl", hash = "sha256:8a3a5915713483bf353b6f4079ba8b2a29029d1d1090a503c70b0dc5d9d0c7bd"}, - {file = "responses-0.23.1.tar.gz", hash = "sha256:c4d9aa9fc888188f0c673eff79a8dadbe2e75b7fe879dc80a221a06e0a68138f"}, + {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"}, + {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"}, ] [package.dependencies] -pyyaml = "*" -requests = ">=2.22.0,<3.0" -types-PyYAML = "*" -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} -urllib3 = ">=1.25.10" - -[package.extras] -tests = ["coverage (>=6.0.0)", "flake8", "mypy", "pytest (>=7.0.0)", "pytest-asyncio", "pytest-cov", "pytest-httpserver", "tomli", "tomli-w", "types-requests"] +six = ">=1.5" [[package]] -name = "setuptools" -version = "67.8.0" -description = "Easily download, build, install, upgrade, and uninstall Python packages" +name = "randomize" +version = "0.14" +description = "Randomize the order of the tests within a unittest.TestCase class" optional = false -python-versions = ">=3.7" +python-versions = "*" files = [ - {file = "setuptools-67.8.0-py3-none-any.whl", hash = "sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f"}, - {file = "setuptools-67.8.0.tar.gz", hash = "sha256:62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102"}, + {file = "randomize-0.14-py2.py3-none-any.whl", hash = "sha256:79c72c1465060e7d22d8fa147fa0452550db83bf0bcf8c0b0694277ebc6f6ff6"}, + {file = "randomize-0.14.tar.gz", hash = "sha256:fe977435ed8f9786c891a0299c99a710751b748d4ddc23ff85fb5eba73983b6b"}, ] -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] -testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] - [[package]] -name = "toml" -version = "0.10.2" -description = "Python Library for Tom's Obvious, Minimal Language" +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" files = [ - {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, - {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] [[package]] @@ -599,95 +356,70 @@ files = [ ] [[package]] -name = "types-pyyaml" -version = "6.0.12.10" -description = "Typing stubs for PyYAML" +name = "tox" +version = "4.14.1" +description = "tox is a generic virtualenv management and test command line tool" optional = false -python-versions = "*" +python-versions = ">=3.8" files = [ - {file = "types-PyYAML-6.0.12.10.tar.gz", hash = "sha256:ebab3d0700b946553724ae6ca636ea932c1b0868701d4af121630e78d695fc97"}, - {file = "types_PyYAML-6.0.12.10-py3-none-any.whl", hash = "sha256:662fa444963eff9b68120d70cda1af5a5f2aa57900003c2006d7626450eaae5f"}, + {file = "tox-4.14.1-py3-none-any.whl", hash = "sha256:b03754b6ee6dadc70f2611da82b4ed8f625fcafd247e15d1d0cb056f90a06d3b"}, + {file = "tox-4.14.1.tar.gz", hash = "sha256:f0ad758c3bbf7e237059c929d3595479363c3cdd5a06ac3e49d1dd020ffbee45"}, ] -[[package]] -name = "typing-extensions" -version = "4.6.2" -description = "Backported and Experimental Type Hints for Python 3.7+" -optional = false -python-versions = ">=3.7" -files = [ - {file = "typing_extensions-4.6.2-py3-none-any.whl", hash = "sha256:3a8b36f13dd5fdc5d1b16fe317f5668545de77fa0b8e02006381fd49d731ab98"}, - {file = "typing_extensions-4.6.2.tar.gz", hash = "sha256:06006244c70ac8ee83fa8282cb188f697b8db25bc8b4df07be1873c43897060c"}, -] +[package.dependencies] +cachetools = ">=5.3.2" +chardet = ">=5.2" +colorama = ">=0.4.6" +filelock = ">=3.13.1" +packaging = ">=23.2" +platformdirs = ">=4.1" +pluggy = ">=1.3" +pyproject-api = ">=1.6.1" +tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} +virtualenv = ">=20.25" + +[package.extras] +docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-argparse-cli (>=1.11.1)", "sphinx-autodoc-typehints (>=1.25.2)", "sphinx-copybutton (>=0.5.2)", "sphinx-inline-tabs (>=2023.4.21)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.11)"] +testing = ["build[virtualenv] (>=1.0.3)", "covdefaults (>=2.3)", "detect-test-pollution (>=1.2)", "devpi-process (>=1)", "diff-cover (>=8.0.2)", "distlib (>=0.3.8)", "flaky (>=3.7)", "hatch-vcs (>=0.4)", "hatchling (>=1.21)", "psutil (>=5.9.7)", "pytest (>=7.4.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-xdist (>=3.5)", "re-assert (>=1.1)", "time-machine (>=2.13)", "wheel (>=0.42)"] [[package]] name = "urllib3" -version = "2.0.2" +version = "2.2.1" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "urllib3-2.0.2-py3-none-any.whl", hash = "sha256:d055c2f9d38dc53c808f6fdc8eab7360b6fdbbde02340ed25cfbcd817c62469e"}, - {file = "urllib3-2.0.2.tar.gz", hash = "sha256:61717a1095d7e155cdb737ac7bb2f4324a858a1e2e6466f6d03ff630ca68d3cc"}, + {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, + {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, ] [package.extras] brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] -secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] [[package]] name = "virtualenv" -version = "20.23.0" +version = "20.25.1" description = "Virtual Python Environment builder" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, - {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, + {file = "virtualenv-20.25.1-py3-none-any.whl", hash = "sha256:961c026ac520bac5f69acb8ea063e8a4f071bcc9457b9c1f28f6b085c511583a"}, + {file = "virtualenv-20.25.1.tar.gz", hash = "sha256:e08e13ecdca7a0bd53798f356d5831434afa5b07b93f0abdf0797b7a06ffe197"}, ] [package.dependencies] -distlib = ">=0.3.6,<1" -filelock = ">=3.11,<4" -importlib-metadata = {version = ">=6.4.1", markers = "python_version < \"3.8\""} -platformdirs = ">=3.2,<4" - -[package.extras] -docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] - -[[package]] -name = "yapf" -version = "0.33.0" -description = "A formatter for Python code." -optional = false -python-versions = "*" -files = [ - {file = "yapf-0.33.0-py2.py3-none-any.whl", hash = "sha256:4c2b59bd5ffe46f3a7da48df87596877189148226ce267c16e8b44240e51578d"}, - {file = "yapf-0.33.0.tar.gz", hash = "sha256:da62bdfea3df3673553351e6246abed26d9fe6780e548a5af9e70f6d2b4f5b9a"}, -] - -[package.dependencies] -tomli = ">=2.0.1" - -[[package]] -name = "zipp" -version = "3.15.0" -description = "Backport of pathlib-compatible object wrapper for zip files" -optional = false -python-versions = ">=3.7" -files = [ - {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, - {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, -] +distlib = ">=0.3.7,<1" +filelock = ">=3.12.2,<4" +platformdirs = ">=3.9.1,<5" [package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] [metadata] lock-version = "2.0" -python-versions = ">=3.7, <4.0" -content-hash = "b6ff1c016cffbcd76fb5a342e2beadce57e4a3ec3895cf33f2cad26348c25dfc" +python-versions = ">=3.8, <4.0" +content-hash = "34d7287c4b27570a1498fe4fd4c371f48fe8fde30b18ee4be5ac65d03935395d" diff --git a/pyproject.toml b/pyproject.toml index 1be49abf..691ed82b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,31 +1,43 @@ +[build-system] +requires = ["poetry-core>=1.8.2"] +build-backend = "poetry.core.masonry.api" + [tool.poetry] name = "openrouteservice" -version = "2.3.3" -description = "Python client for requests to openrouteservice API services." -authors = ["Julian Psotta "] -readme = 'README.rst' -license = "Apache2" +version = "8.2.0" +authors = ["HeiGIT gGmbH "] +description = "Python client for requests to openrouteservice API services" +readme = "README.md" +keywords = ["routing","accessibility","router","OSM","ORS","openrouteservice","openstreetmap","isochrone","POI","elevation","DEM","swagger"] +license = "Apache 2.0" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", +] [tool.poetry.dependencies] -python = ">=3.7, <4.0" -requests = ">=2.31.0" -responses = ">=0.23.1" -poetry2conda = "^0.3.0" - +python = ">=3.8, <4.0" +urllib3 = "^2.2.1" +six = "^1.16.0" +certifi = "^2024.2.2" +python-dateutil = "^2.9.0.post0" [tool.poetry.dev-dependencies] -pytest = ">=7.3.1" -pytest-cov = ">=4.1.0" -yapf = ">=0.33.0" -importlib-metadata = ">=6.6.0" -virtualenv = { version = ">=20.23.0", python = ">=3.6, <4.0" } -pre-commit = { version = ">=2.21.0", python = ">=3.6, <4.0" } -coverage = "^7.2.7" -pytest-xdist = "^3.3.1" +pytest = "^8.1.1" +pytest-cov = "^4.1.0" +coverage = "^7.4.4" +pytest-xdist = "^3.5.0" +pluggy = "^1.4.0" +py = "^1.11.0" +randomize = "^0.14" +tox = "^4.14.1" [tool.pytest.ini_options] -addopts = "--cov=openrouteservice --cov-report xml --cov-report term-missing --cov-fail-under 96 -n auto" +addopts = "--cov=openrouteservice --cov-report xml --cov-report term-missing --cov-fail-under 50 -n auto" -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +[tool.poetry.urls] +homepage = "https://openrouteservice.org/" +"Forum" = "https://ask.openrouteservice.org/c/sdks" +"API Documentation" = "https://openrouteservice.org/documentation/" +"API Terms of service" = "https://openrouteservice.org/terms-of-service/" diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..59a66ec2 --- /dev/null +++ b/setup.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.2.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 8.2.0 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from setuptools import setup, find_packages # noqa: H301 + +NAME = "openrouteservice" +VERSION = "8.2.0" +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"] + +setup( + name=NAME, + version=VERSION, + description="Openrouteservice", + author_email="support@smartmobility.heigit.org", + url="https://openrouteservice.org", + keywords=["routing","accessibility","router","OSM","ORS","openrouteservice","openstreetmap","isochrone","POI","elevation","DEM","swagger"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + Python client for requests to openrouteservice API services + """ +) diff --git a/test/__init__.py b/test/__init__.py index 18f68289..576f56f8 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,51 +1 @@ -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# - -import unittest -import openrouteservice - -from urllib.parse import urlparse, parse_qsl - -# For relative imports to work in Python 3.6 -import os -import sys - -sys.path.append(os.path.dirname(os.path.realpath(__file__))) - - -class TestCase(unittest.TestCase): - def setUp(self): - self.key = "sample_key" - self.client = openrouteservice.Client(self.key) - - def assertURLEqual(self, first, second, msg=None): - """Check that two arguments are equivalent URLs. Ignores the order of - query arguments. - """ - first_parsed = urlparse(first) - second_parsed = urlparse(second) - self.assertEqual(first_parsed[:3], second_parsed[:3], msg) - - first_qsl = sorted(parse_qsl(first_parsed.query)) - second_qsl = sorted(parse_qsl(second_parsed.query)) - self.assertEqual(first_qsl, second_qsl, msg) - - def assertDictContainsSubset(self, a, b, **kwargs): - """Replaces deprecated unittest.TestCase.assertDictContainsSubset""" - c = dict([(k, b[k]) for k in a.keys() if k in b.keys()]) - self.assertEqual(a, c) +# coding: utf-8 \ No newline at end of file diff --git a/test/test_client.py b/test/test_client.py deleted file mode 100644 index f1673db1..00000000 --- a/test/test_client.py +++ /dev/null @@ -1,182 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# -"""Tests for client module.""" - -import responses -import time - -import openrouteservice -from test.test_helper import * -import test as _test - - -class ClientTest(_test.TestCase): - def test_no_api_key(self): - with self.assertRaises(ValueError): - client = openrouteservice.Client() - client.directions(PARAM_LINE) - - def test_invalid_api_key(self): - with self.assertRaises(openrouteservice.exceptions.ApiError): - client = openrouteservice.Client(key="Invalid key.") - client.directions(PARAM_LINE) - - def test_urlencode(self): - encoded_params = openrouteservice.client._urlencode_params( - [("address", "=Sydney ~")] - ) - self.assertEqual("address=%3DSydney+~", encoded_params) - - @responses.activate - def test_raise_over_query_limit(self): - valid_query = ENDPOINT_DICT["directions"] - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - valid_query["profile"] - ), - json=valid_query, - status=429, - content_type="application/json", - ) - - with self.assertRaises(openrouteservice.exceptions._OverQueryLimit): - client = openrouteservice.Client( - key=self.key, retry_over_query_limit=False - ) - client.directions(**valid_query) - - with self.assertRaises(openrouteservice.exceptions.Timeout): - client = openrouteservice.Client( - key=self.key, retry_over_query_limit=True, retry_timeout=3 - ) - client.directions(**valid_query) - - @responses.activate - def test_raise_timeout_retriable_requests(self): - # Mock query gives 503 as HTTP status, code should try a few times to - # request the same and then fail on Timout() error. - retry_timeout = 3 - valid_query = ENDPOINT_DICT["directions"] - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - valid_query["profile"] - ), - json=valid_query, - status=503, - content_type="application/json", - ) - - client = openrouteservice.Client( - key=self.key, retry_timeout=retry_timeout - ) - - start = time.time() - with self.assertRaises(openrouteservice.exceptions.Timeout): - client.directions(**valid_query) - end = time.time() - self.assertTrue(retry_timeout < end - start < 3 * retry_timeout) - - @responses.activate - def test_host_override_with_parameters(self): - # Test if it's possible to override host for individual hosting. - responses.add( - responses.GET, - "https://foo.com/bar", - body='{"status":"OK","results":[]}', - status=200, - content_type="application/json", - ) - - client = openrouteservice.Client(base_url="https://foo.com") - client.request("/bar", {"bunny": "pretty", "fox": "prettier"}) - - request = client.req - - self.assertEqual( - "https://foo.com/bar?bunny=pretty&fox=prettier", request.url - ) - self.assertEqual("GET", request.method) - self.assertEqual({"bunny": "pretty", "fox": "prettier"}, request.params) - - self.assertURLEqual( - "https://foo.com/bar?bunny=pretty&fox=prettier", - responses.calls[0].request.url, - ) - self.assertEqual(1, len(responses.calls)) - - @responses.activate - def test_dry_run(self): - # Test that nothing is requested when dry_run is 'true' - - responses.add( - responses.GET, - "https://api.openrouteservice.org/directions", - body='{"status":"OK","results":[]}', - status=200, - content_type="application/json", - ) - - req = self.client.request( - get_params={"format_out": "geojson"}, - url="directions/", - dry_run="true", - ) - - self.assertEqual(0, len(responses.calls)) - - @responses.activate - def test_no_get_parameter(self): - responses.add( - responses.POST, - "https://api.openrouteservice.org/directions", - body='{"status":"OK","results":[]}', - status=200, - content_type="application/json", - ) - - req = self.client.request( - post_json={}, url="v2/directions/driving-car/json", dry_run="true" - ) - - self.assertEqual(0, len(responses.calls)) - - # Test if the client works with a post request without a get parameter - - @responses.activate - def test_key_in_header(self): - # Test that API key is being put in the Authorization header - query = ENDPOINT_DICT["directions"] - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - query["profile"] - ), - json=ENDPOINT_DICT["directions"], - status=200, - content_type="application/json", - ) - - resp = self.client.directions(**query) - - self.assertDictContainsSubset( - {"Authorization": self.key}, responses.calls[0].request.headers - ) diff --git a/test/test_convert.py b/test/test_convert.py deleted file mode 100644 index e0cea774..00000000 --- a/test/test_convert.py +++ /dev/null @@ -1,113 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# -"""Tests for the convert module.""" - -import unittest - -from openrouteservice import convert - - -class ConvertTest(unittest.TestCase): - def test_build_single_coord_tuple(self): - expected = "1,2" - ll = (1, 2) - self.assertEqual(expected, convert._build_coords(ll)) - - ll = [1, 2] - self.assertEqual(expected, convert._build_coords(ll)) - - with self.assertRaises(TypeError): - convert._build_coords(1) - - with self.assertRaises(TypeError): - convert._build_coords({"lat": 1, "lon": 2}) - - with self.assertRaises(TypeError): - convert._build_coords("1,2") - - def test_build_multi_coord_tuple(self): - expected = "1,2|3,4" - - ll = ((1, 2), (3, 4)) - self.assertEqual(expected, convert._build_coords(ll)) - - ll = [(1, 2), (3, 4)] - self.assertEqual(expected, convert._build_coords(ll)) - - ll = ([1, 2], [3, 4]) - self.assertEqual(expected, convert._build_coords(ll)) - - ll = [[1, 2], [3, 4]] - self.assertEqual(expected, convert._build_coords(ll)) - - with self.assertRaises(TypeError): - convert._build_coords({{"lat": 1, "lon": 2}, {"lat": 3, "lon": 4}}) - - with self.assertRaises(TypeError): - convert._build_coords("[1,2],[3,4]") - - def test_convert_bool(self): - self.assertEqual("true", convert._convert_bool("True")) - self.assertEqual("true", convert._convert_bool("true")) - self.assertEqual("true", convert._convert_bool(True)) - - def test_polyline_decode_3d(self): - syd_mel_route = ( - r"mlqlHat`t@OiACMvAs@HCPGJ?JAJBRFTRLJPNHDNDJ" - "@D?fACRAZCPAb@AF?HAfBQJEDAn@QFC@QD_@@QFe@Bg" - "@@KBy@?M@a@@q@?iE?C?OGgAkEwUQ{@c@gBQeAYeCIe" - "AWmDAIImACUOyBIeAC}@Ey@?QLC@_@@KBiAVmDF]Ni@" - "Zu@RYBA^_@~A{A`Ai@JCPGf@Qf@]X_@BMAMIKuBTI?G" - "E?A?ADOnCsB\c@DGDIl@sAJUFMBGJUP[DCD@DP@l@?R" - "?h@Bx@PnAAl@?BAFc@rAAB?@BRHBFEN[FQFQRg@Rw@J" - "g@Ny@DUDOJe@N_ADm@BkBGcC@s@Du@l@eEZgBP_AHe@" - "He@Fc@RuATaA?SCWAGIOQS[Qu@Ym@C}@R{@`@m@p@Wj" - "@]nAGBE?KGAE?E?KVcB`@eB^mAn@uALUJSj@y@fA}@f" - "@k@BGHM^k@r@qAHSLU^i@bA_Af@q@PYFKHIHCJ?RLFN" - "XjAj@tDj@rERzBLzCHp@xAdKLf@RXTDNEBCFGDEDE@G" - "@GDKBGRc@Xi@N[JUf@u@l@o@f@c@h@]XMfQ}D|EcAlA" - "ORIJQ?C?CAUKOSGwAMa@M_EsBcBqA_A{@k@q@sCcEi@" - "gAWo@[gAYyAMy@y@aNMyAc@uDS_As@uBMc@Ig@SeBKc" - "@Uy@AI@A]GGCMIiCmAGCWMqAk@" - ) - - points = convert.decode_polyline(syd_mel_route, True)["coordinates"] - self.assertEqual(len(points[0]), 3) - self.assertAlmostEqual(8.69201, points[0][0], places=5) - self.assertAlmostEqual(49.410151, points[0][1], places=5) - self.assertAlmostEqual(0.1, points[0][2], places=2) - self.assertAlmostEqual(8.69917, points[-1][0], places=5) - self.assertAlmostEqual(49.41868, points[-1][1], places=5) - self.assertAlmostEqual(12.5, points[-1][2], places=2) - - def test_polyline_decode_2d(self): - syd_mel_route = r"u`rgFswjpAKD" - - points = convert.decode_polyline(syd_mel_route, False)["coordinates"] - self.assertEqual(len(points[0]), 2) - self.assertAlmostEqual([13.3313, 38.10843], points[0], places=5) - self.assertAlmostEqual([13.33127, 38.10849], points[1], places=5) - - def test_pipe_list_bad_argument(self): - with self.assertRaises(TypeError): - convert._pipe_list(5) - - def test_comma_list_bad_argument(self): - with self.assertRaises(TypeError): - convert._comma_list(5) diff --git a/test/test_deprecation_warning.py b/test/test_deprecation_warning.py deleted file mode 100644 index 0377f861..00000000 --- a/test/test_deprecation_warning.py +++ /dev/null @@ -1,13 +0,0 @@ -import warnings - -from openrouteservice import deprecation - -with warnings.catch_warnings(record=True) as w: - # Cause all warnings to always be triggered. - warnings.simplefilter("always") - # Trigger a warning. - deprecation.warning("foo", "bar") - # Verify some things - assert len(w) == 1 - assert issubclass(w[-1].category, DeprecationWarning) - assert "deprecated" in str(w[-1].message) diff --git a/test/test_directions.py b/test/test_directions.py deleted file mode 100644 index 6fb3b664..00000000 --- a/test/test_directions.py +++ /dev/null @@ -1,230 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# -"""Tests for the directions module.""" - -import responses -import warnings - -import test as _test -from copy import deepcopy - -from openrouteservice import exceptions -from test.test_helper import ENDPOINT_DICT, GPX_RESPONSE - - -class DirectionsTest(_test.TestCase): - valid_query = ENDPOINT_DICT["directions"] - - @responses.activate - def test_directions(self): - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - self.valid_query["profile"] - ), - json=self.valid_query, - status=200, - content_type="application/json", - ) - - resp = self.client.directions(**self.valid_query) - - self.assertEqual(resp, self.valid_query) - self.assertIn("sample_key", responses.calls[0].request.headers.values()) - - @responses.activate - def test_directions_gpx(self): - query = deepcopy(self.valid_query) - query["format"] = "gpx" - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/gpx".format( - self.valid_query["profile"] - ), - body=GPX_RESPONSE, - status=200, - content_type="application/gpx+xml;charset=UTF-8", - ) - - resp = self.client.directions(**query) - - self.assertEqual(resp, GPX_RESPONSE) - self.assertIn("sample_key", responses.calls[0].request.headers.values()) - - @responses.activate - def test_directions_incompatible_parameters(self): - self.valid_query["optimized"] = True - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - self.valid_query["profile"] - ), - json=self.valid_query, - status=200, - content_type="application/json", - ) - - resp = self.client.directions(**self.valid_query) - - self.assertEqual(resp, self.valid_query) - self.assertIn("sample_key", responses.calls[0].request.headers.values()) - - def test_format_out_deprecation(self): - bad_query = deepcopy(self.valid_query) - bad_query["format_out"] = "json" - bad_query["dry_run"] = True - - with warnings.catch_warnings(record=True) as w: - # Cause all warnings to always be triggered. - warnings.simplefilter("always") - # Trigger a warning. - _ = self.client.directions(**bad_query) - - assert len(w) == 1 - assert issubclass(w[-1].category, DeprecationWarning) - assert "deprecated" in str(w[-1].message) - - def test_optimized_waypoints(self): - query = deepcopy(self.valid_query) - query["coordinates"] = [ - [8.688641, 49.420577], - [8.680916, 49.415776], - [8.688641, 49.420577], - [8.680916, 49.415776], - ] - query["optimize_waypoints"] = True - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - query["profile"] - ), - json=query, - status=200, - content_type="application/json", - ) - - # Too exhausting to really test this - with self.assertRaises(exceptions.ApiError): - resp = self.client.directions(**query) - - def test_optimized_waypoints_shuffle(self): - query = deepcopy(self.valid_query) - query["coordinates"] = [ - [8.688641, 49.420577], - [8.680916, 49.415776], - [8.688641, 49.420577], - [8.680916, 49.415776], - ] - query["optimize_waypoints"] = True - query.pop("options") - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - query["profile"] - ), - json=query, - status=200, - content_type="application/json", - ) - with self.assertRaises(exceptions.ApiError): - resp = self.client.directions(**query) - - @responses.activate - def test_optimize_warnings(self): - query = deepcopy(self.valid_query) - query["optimize_waypoints"] = True - - # Test Coordinates - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - query["profile"] - ), - json=query, - status=200, - content_type="application/json", - ) - - with warnings.catch_warnings(record=True) as w: - # Cause all warnings to always be triggered. - warnings.simplefilter("always") - - resp = self.client.directions(**query) - - assert len(w) == 1 - assert issubclass(w[-1].category, UserWarning) - assert "4 coordinates" in str(w[-1].message) - - # Test Options - - query["coordinates"] = [ - [8.688641, 49.420577], - [8.680916, 49.415776], - [8.688641, 49.420577], - [8.680916, 49.415776], - ] - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - query["profile"] - ), - json=query, - status=200, - content_type="application/json", - ) - - with warnings.catch_warnings(record=True) as w: - # Cause all warnings to always be triggered. - warnings.simplefilter("always") - - resp = self.client.directions(**query) - - assert len(w) == 1 - assert issubclass(w[-1].category, UserWarning) - assert "Options" in str(w[-1].message) - - # Test Preference - - query["options"] = None - query["preference"] = "shortest" - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/directions/{}/geojson".format( - query["profile"] - ), - json=query, - status=200, - content_type="application/json", - ) - - with warnings.catch_warnings(record=True) as w: - # Cause all warnings to always be triggered. - warnings.simplefilter("always") - - resp = self.client.directions(**query) - - assert len(w) == 1 - assert issubclass(w[-1].category, UserWarning) - assert "Shortest" in str(w[-1].message) diff --git a/test/test_directions_service_api.py b/test/test_directions_service_api.py new file mode 100644 index 00000000..4b662cc0 --- /dev/null +++ b/test/test_directions_service_api.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: v2 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest +import configparser + +import openrouteservice +from openrouteservice.api.directions_service_api import DirectionsServiceApi # noqa: E501 +from openrouteservice.rest import ApiException +from openrouteservice import apiClient + +class TestDirectionsServiceApi(unittest.TestCase): + """DirectionsServiceApi unit test stubs""" + + def setUp(self): + cfg = configparser.ConfigParser() + cfg.read('tests-config.ini') + self.api = DirectionsServiceApi(apiClient(cfg['ORS']['apiKey'])) # noqa: E501 + + def tearDown(self): + pass + + def test_get_geo_json_route(self): + """Test case for get_geo_json_route + + Directions Service GeoJSON # noqa: E501 + """ + body = openrouteservice.DirectionsServiceBody( + coordinates=[[8.681495,49.41461],[8.686507,49.41943],[8.687872,49.420318]] + ) + profile = 'driving-car' + response = self.api.get_geo_json_route(body, profile) + self.assertEqual(response["bbox"], [8.681423, 49.414599, 8.690123, 49.420514]) + + #def test_get_gpx_route(self): + # """Test case for get_gpx_route + # + # Directions Service GPX # noqa: E501 + # """ + # coordinates = [[8.681495,49.41461],[8.686507,49.41943],[8.687872,49.420318]] + # body = openrouteservice.DirectionsService1( + # coordinates=coordinates + # ) + # profile = 'driving-car' + # response = self.api.get_gpx_route(body, profile) + # self.assertIsNotNone(response) + + def test_get_json_route(self): + """Test case for get_json_route + + Directions Service JSON # noqa: E501 + """ + body = openrouteservice.DirectionsServiceBody( + coordinates=[[8.681495,49.41461],[8.686507,49.41943],[8.687872,49.420318]] + ) + profile = 'driving-car' + response = self.api.get_json_route(body, profile) + self.assertIsNotNone(response) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_distance_matrix.py b/test/test_distance_matrix.py deleted file mode 100644 index 6047af6c..00000000 --- a/test/test_distance_matrix.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# -"""Tests for the distance matrix module.""" -import responses -import test as _test - -from test.test_helper import ENDPOINT_DICT, PARAM_LINE - - -class DistanceMatrixTest(_test.TestCase): - valid_query = ENDPOINT_DICT["distance_matrix"] - - @responses.activate - def test_matrix(self): - query = self.valid_query.copy() - query["locations"] = tuple([tuple(x) for x in PARAM_LINE]) - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/matrix/{}/json".format( - query["profile"] - ), - json=query, - status=200, - content_type="application/json", - ) - - resp = self.client.distance_matrix(**query) - self.assertEqual(resp, self.valid_query) diff --git a/test/test_elevation.py b/test/test_elevation.py deleted file mode 100644 index f44bc523..00000000 --- a/test/test_elevation.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -"""Tests for the distance matrix module.""" -import responses -import test as _test - -from test.test_helper import ENDPOINT_DICT - - -class ElevationTest(_test.TestCase): - valid_query = ENDPOINT_DICT["elevation_line"] - - @responses.activate - def test_elevation_line(self): - responses.add( - responses.POST, - "https://api.openrouteservice.org/elevation/line", - json=self.valid_query, - status=200, - content_type="application/json", - ) - - resp = self.client.elevation_line(**self.valid_query) - - self.assertEqual(len(responses.calls), 1) - self.assertEqual(resp, self.valid_query) - - @responses.activate - def test_elevation_point(self): - query = ENDPOINT_DICT["elevation_point"] - responses.add( - responses.POST, - "https://api.openrouteservice.org/elevation/point", - json=self.valid_query, - status=200, - content_type="application/json", - ) - - resp = self.client.elevation_point(**query) - - self.assertEqual(len(responses.calls), 1) - self.assertEqual(resp, self.valid_query) diff --git a/test/test_elevation_api.py b/test/test_elevation_api.py new file mode 100644 index 00000000..8e3d9cb2 --- /dev/null +++ b/test/test_elevation_api.py @@ -0,0 +1,69 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: v2 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest +import configparser + +import openrouteservice +from openrouteservice.api.elevation_api import ElevationApi # noqa: E501 +from openrouteservice.rest import ApiException +from openrouteservice import apiClient + +class TestElevationApi(unittest.TestCase): + """ElevationApi unit test stubs""" + + def setUp(self): + cfg = configparser.ConfigParser() + cfg.read('tests-config.ini') + self.api = ElevationApi(apiClient(cfg['ORS']['apiKey'])) # noqa: E501 + + def tearDown(self): + pass + + def test_elevation_line_post(self): + """Test case for elevation_line_post + + Elevation Line Service # noqa: E501 + """ + body = openrouteservice.ElevationLineBody( + format_in="encodedpolyline5", + geometry="u`rgFswjpAKD" + ) + response = self.api.elevation_line_post(body) + self.assertEqual(response["geometry"]["coordinates"][0], [13.3313, 38.10843, 72.0]) + + def test_elevation_point_get(self): + """Test case for elevation_point_get + + Elevation Point Service # noqa: E501 + """ + response = self.api.elevation_point_get(geometry=[13.331273, 38.10849]) + self.assertEqual(response["geometry"]["coordinates"], [13.331273,38.10849,72]) + + def test_elevation_point_post(self): + """Test case for elevation_point_post + + Elevation Point Service # noqa: E501 + """ + body = openrouteservice.ElevationPointBody( + format_in='point', + geometry=[13.331273, 38.10849] + ) + + response = self.api.elevation_point_post(body) + self.assertEqual(response["geometry"]["coordinates"], [13.331273,38.10849,72]) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_exceptions.py b/test/test_exceptions.py deleted file mode 100644 index c617b4b9..00000000 --- a/test/test_exceptions.py +++ /dev/null @@ -1,60 +0,0 @@ -from openrouteservice.exceptions import ( - ValidationError, - ApiError, - HTTPError, - Timeout, - _RetriableRequest, - _OverQueryLimit, -) - -import test as _test - -from pprint import pprint - - -class ExceptionTest(_test.TestCase): - def test_ValidationError(self): - exception = ValidationError("hamspam") - - pprint(exception.__dict__) - self.assertIsInstance(exception, Exception) - - def test_ApIError(self): - exception = ApiError(500, "hamspam") - - pprint(exception.__dict__) - - self.assertEqual(exception.status, 500) - self.assertEqual(exception.message, "hamspam") - - self.assertEqual(str(exception), "500 (hamspam)") - - exception = ApiError(500) - - self.assertEqual(str(exception), "500") - - def test_HTTPError(self): - exception = HTTPError(500) - - self.assertEqual(exception.status_code, 500) - - self.assertEqual(str(exception), "HTTP Error: 500") - - def test_Timeout(self): - exception = Timeout() - - self.assertIsInstance(exception, Exception) - - def test_RetriableRequest(self): - exception = _RetriableRequest() - - self.assertIsInstance(exception, Exception) - - def test_OverQueryLimit(self): - exception = _OverQueryLimit(500, "hamspam") - - self.assertIsInstance(exception, Exception) - self.assertIsInstance(exception, ApiError) - self.assertIsInstance(exception, _RetriableRequest) - - self.assertEqual(str(exception), "500 (hamspam)") diff --git a/test/test_geocode.py b/test/test_geocode.py deleted file mode 100644 index 18106a2d..00000000 --- a/test/test_geocode.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -"""Tests for the Pelias geocoding module.""" - -import responses - -import test as _test -from test.test_helper import ENDPOINT_DICT - - -class GeocodingPeliasTest(_test.TestCase): - search = ENDPOINT_DICT["pelias_search"] - autocomplete = ENDPOINT_DICT["pelias_autocomplete"] - structured = ENDPOINT_DICT["pelias_structured"] - reverse = ENDPOINT_DICT["pelias_reverse"] - - @responses.activate - def test_pelias_search(self): - responses.add( - responses.GET, - "https://api.openrouteservice.org/geocode/search", - body='{"status":"OK","results":[]}', - status=200, - content_type="application/json", - ) - - results = self.client.pelias_search(**self.search) - - self.assertEqual(1, len(responses.calls)) - self.assertURLEqual( - "https://api.openrouteservice.org/geocode/search?boundary.circle.lat=48.23424&boundary.circle.lon=8.34234&boundary.circle.radius=50&boundary.country=de&boundary.rect.max_lat=501&boundary.rect.max_lon=501&boundary.rect.min_lat=500&boundary.rect.min_lon=500&focus.point.lat=48.23424&focus.point.lon=8.34234&layers=locality%2Ccounty%2Cregion&size=50&sources=osm%2Cwof%2Cgn&text=Heidelberg", - responses.calls[0].request.url, - ) - - @responses.activate - def test_pelias_autocomplete(self): - responses.add( - responses.GET, - "https://api.openrouteservice.org/geocode/autocomplete", - body='{"status":"OK","results":[]}', - status=200, - content_type="application/json", - ) - - results = self.client.pelias_autocomplete(**self.autocomplete) - - self.assertEqual(1, len(responses.calls)) - self.assertURLEqual( - "https://api.openrouteservice.org/geocode/autocomplete?boundary.country=de&boundary.rect.max_lon%09=500&boundary.rect.min_lat%09=500&boundary.rect.min_lon%09=500&focus.point.lat=48.23424&focus.point.lon=8.34234&layers=locality%2Ccounty%2Cregion&sources=osm%2Cwof%2Cgn&text=Heidelberg", - responses.calls[0].request.url, - ) - - @responses.activate - def test_pelias_structured(self): - responses.add( - responses.GET, - "https://api.openrouteservice.org/geocode/search/structured", - body='{"status":"OK","results":[]}', - status=200, - content_type="application/json", - ) - - results = self.client.pelias_structured(**self.structured) - - self.assertEqual(1, len(responses.calls)) - self.assertURLEqual( - "https://api.openrouteservice.org/geocode/search/structured?address=Berliner+Stra%C3%9Fe+45&borough=Heidelberg&country=de&county=Rhein-Neckar-Kreis&locality=Heidelberg&neighbourhood=Neuenheimer+Feld&postalcode=69120®ion=Baden-W%C3%BCrttemberg", - responses.calls[0].request.url, - ) - - @responses.activate - def test_pelias_reverse(self): - responses.add( - responses.GET, - "https://api.openrouteservice.org/geocode/reverse", - body='{"status":"OK","results":[]}', - status=200, - content_type="application/json", - ) - - results = self.client.pelias_reverse(**self.reverse) - - self.assertEqual(1, len(responses.calls)) - self.assertURLEqual( - "https://api.openrouteservice.org/geocode/reverse?boundary.circle.radius=50&boundary.country=de&layers=locality%2Ccounty%2Cregion&point.lat=48.23424&point.lon=8.34234&size=50&sources=osm%2Cwof%2Cgn", - responses.calls[0].request.url, - ) diff --git a/test/test_geocode_api.py b/test/test_geocode_api.py new file mode 100644 index 00000000..f180286c --- /dev/null +++ b/test/test_geocode_api.py @@ -0,0 +1,75 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: v2 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest +import configparser + +import openrouteservice +from openrouteservice.api.geocode_api import GeocodeApi # noqa: E501 +from openrouteservice.rest import ApiException +from openrouteservice import apiClient + +class TestGeocodeApi(unittest.TestCase): + """GeocodeApi unit test stubs""" + + def setUp(self): + cfg = configparser.ConfigParser() + cfg.read('tests-config.ini') + self.api = GeocodeApi(apiClient(cfg['ORS']['apiKey'])) # noqa: E501 + + def tearDown(self): + pass + + def test_geocode_autocomplete_get(self): + """Test case for geocode_autocomplete_get + + Geocode Autocomplete Service # noqa: E501 + """ + text = "Toky" + response = self.api.geocode_autocomplete_get(text) + self.assertIsNotNone(response) + self.assertEqual(len(response["features"]), 10) + + def test_geocode_reverse_get(self): + """Test case for geocode_reverse_get + + Reverse Geocode Service # noqa: E501 + """ + lon = 2.294471 + lat = 48.858268 + response = self.api.geocode_reverse_get(lon, lat) + self.assertIsNotNone(response) + self.assertEqual(len(response["features"]), 10) + + def test_geocode_search_get(self): + """Test case for geocode_search_get + + Forward Geocode Service # noqa: E501 + """ + text = "Namibian Brewery" + response = self.api.geocode_search_get(text) + self.assertIsNotNone(response) + self.assertEqual(len(response["features"]), 10) + + def test_geocode_search_structured_get(self): + """Test case for geocode_search_structured_get + + Structured Forward Geocode Service (beta) # noqa: E501 + """ + response = self.api.geocode_search_structured_get(locality='Tokyo') + self.assertIsNotNone(response) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_helper.py b/test/test_helper.py deleted file mode 100644 index 338c3697..00000000 --- a/test/test_helper.py +++ /dev/null @@ -1,256 +0,0 @@ -# -*- coding: utf-8 -*- - -PARAM_POINT = [8.34234, 48.23424] -PARAM_LINE = [[8.688641, 49.420577], [8.680916, 49.415776]] -PARAM_POLY = [[[8.688641, 49.420577], [8.680916, 49.415776]]] - -PARAM_INT_BIG = 500 -PARAM_INT_SMALL = 50 -PARAM_LIST_ONE = [PARAM_INT_SMALL, PARAM_INT_SMALL] -PARAM_LIST_TWO = [PARAM_LIST_ONE, PARAM_LIST_ONE] - -PARAM_GEOJSON_POINT = {"type": "Point", "coordinates": PARAM_POINT} -PARAM_GEOJSON_LINE = {"type": "LineString", "coordinates": PARAM_LINE} -PARAM_GEOJSON_POLY = {"type": "Polygon", "coordinates": PARAM_POLY} - -ENDPOINT_DICT = { - "directions": { - "coordinates": PARAM_LINE, - "profile": "driving-car", - "preference": "fastest", - "format": "geojson", - "units": "mi", - "language": "en", - "geometry": "true", - "geometry_simplify": "false", - "maneuvers": True, - "suppress_warnings": False, - "instructions": "false", - "instructions_format": "html", - "alternative_routes": { - "share_factor": 0.6, - "target_count": 2, - "weight_factor": 1.4, - }, - "roundabout_exits": "true", - "attributes": ["avgspeed"], - "radiuses": PARAM_LIST_ONE, - "bearings": PARAM_LIST_TWO, - "skip_segments": [0, 1], - "elevation": "true", - "maximum_speed": 95, - "extra_info": ["roadaccessrestrictions"], - "optimized": "false", - "continue_straight": True, - "options": {"avoid_features": ["highways", "tollways"]}, - }, - "isochrones": { - "locations": PARAM_LINE, - "profile": "cycling-regular", - "range_type": "distance", - "range": [PARAM_INT_BIG], - "units": "m", - "location_type": "destination", - "attributes": ["area", "reachfactor"], - "interval": [PARAM_INT_SMALL], - "intersections": "true", - "options": {"avoid_features": ["highways", "tollways"]}, - }, - "distance_matrix": { - "locations": PARAM_LINE, - "sources": [1], - "destinations": [0], - "profile": "driving-car", - "metrics": ["duration", "distance"], - "resolve_locations": "true", - "units": "mi", - "optimized": "false", - }, - "elevation_point": { - "format_in": "geojson", - "format_out": "point", - "geometry": PARAM_GEOJSON_POINT, - "dataset": "srtm", - }, - "elevation_line": { - "format_in": "geojson", - "format_out": "polyline", - "geometry": PARAM_GEOJSON_LINE, - "dataset": "srtm", - }, - "pelias_search": { - "text": "Heidelberg", - "focus_point": PARAM_POINT, - "rect_min_x": PARAM_INT_BIG, - "rect_min_y": PARAM_INT_BIG, - "rect_max_x": PARAM_INT_BIG + 1, - "rect_max_y": PARAM_INT_BIG + 1, - "circle_point": PARAM_POINT, - "circle_radius": PARAM_INT_SMALL, - "sources": ["osm", "wof", "gn"], - "layers": ["locality", "county", "region"], - "country": "de", - "size": PARAM_INT_SMALL, - }, - "pelias_autocomplete": { - "text": "Heidelberg", - "focus_point": PARAM_POINT, - "rect_min_x": PARAM_INT_BIG, - "rect_min_y": PARAM_INT_BIG, - "rect_max_x": PARAM_INT_BIG, - "rect_max_y": PARAM_INT_BIG, - "sources": ["osm", "wof", "gn"], - "layers": ["locality", "county", "region"], - "country": "de", - }, - "pelias_structured": { - "address": "Berliner Straße 45", - "neighbourhood": "Neuenheimer Feld", - "borough": "Heidelberg", - "locality": "Heidelberg", - "county": "Rhein-Neckar-Kreis", - "region": "Baden-Württemberg", - "postalcode": 69120, - "country": "de", - }, - "pelias_reverse": { - "point": PARAM_POINT, - "circle_radius": PARAM_INT_SMALL, - "sources": ["osm", "wof", "gn"], - "layers": ["locality", "county", "region"], - "country": "de", - "size": PARAM_INT_SMALL, - }, - "pois": { - "request": "pois", - "geojson": PARAM_GEOJSON_POINT, - "bbox": PARAM_LINE, - "buffer": PARAM_INT_SMALL, - "filter_category_ids": [PARAM_INT_SMALL], - "filter_category_group_ids": [PARAM_INT_BIG], - "filters_custom": { - "name": "Deli", - "wheelchair": ["yes", "limited"], - "smoking": ["dedicated", "separated"], - "fee": ["yes", "no"], - }, - "limit": PARAM_INT_SMALL, - "sortby": "distance", - }, - "optimization": { - "shipments": [ - { - "pickup": { - "id": 0, - "location": [8.688641, 49.420577], - "location_index": 0, - "service": 500, - "time_windows": [[50, 50]], - }, - "delivery": { - "id": 0, - "location": [8.688641, 49.420577], - "location_index": 0, - "service": 500, - "time_windows": [[50, 50]], - }, - "amount": [50], - "skills": [50, 50], - "priority": 50, - }, - { - "pickup": { - "id": 1, - "location": [8.680916, 49.415776], - "location_index": 1, - "service": 500, - "time_windows": [[50, 50]], - }, - "delivery": { - "id": 1, - "location": [8.680916, 49.415776], - "location_index": 1, - "service": 500, - "time_windows": [[50, 50]], - }, - "amount": [50], - "skills": [50, 50], - "priority": 50, - }, - ], - "jobs": [ - { - "id": 0, - "location": PARAM_LINE[0], - "location_index": 0, - "service": PARAM_INT_BIG, - "amount": [PARAM_INT_SMALL], - "skills": PARAM_LIST_ONE, - "priority": PARAM_INT_SMALL, - "time_windows": [PARAM_LIST_ONE], - }, - { - "id": 1, - "location": PARAM_LINE[1], - "location_index": 1, - "service": PARAM_INT_BIG, - "amount": [PARAM_INT_SMALL], - "skills": PARAM_LIST_ONE, - "priority": PARAM_INT_SMALL, - "time_windows": [PARAM_LIST_ONE], - }, - ], - "vehicles": [ - { - "id": 0, - "profile": "driving-car", - "start": PARAM_LINE[0], - "start_index": 0, - "end_index": 0, - "end": PARAM_LINE[0], - "capacity": [PARAM_INT_SMALL], - "skills": PARAM_LIST_ONE, - "time_window": PARAM_LIST_ONE, - }, - { - "id": 1, - "profile": "driving-car", - "start": PARAM_LINE[1], - "start_index": 1, - "end_index": 1, - "end": PARAM_LINE[1], - "capacity": [PARAM_INT_SMALL], - "skills": PARAM_LIST_ONE, - "time_window": PARAM_LIST_ONE, - }, - ], - "options": {"g": False}, - "matrix": PARAM_LIST_TWO, - }, -} - -GPX_RESPONSE = """ - - - - openrouteservice directions - This is a directions instructions file as GPX, generated from openrouteservice - openrouteservice - - - https://openrouteservice.org/ - text/html - - - - 2021 - LGPL 3.0 - - - - - - - - -""" diff --git a/test/test_isochrones.py b/test/test_isochrones.py deleted file mode 100644 index ee3ab55b..00000000 --- a/test/test_isochrones.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# -"""Tests for the distance matrix module.""" -import responses -import test as _test -from test.test_helper import ENDPOINT_DICT -import pytest - - -class IsochronesTest(_test.TestCase): - @responses.activate - def test_isochrones(self): - query = ENDPOINT_DICT["isochrones"] - - responses.add( - responses.POST, - "https://api.openrouteservice.org/v2/isochrones/{}/geojson".format( - query["profile"] - ), - json=query, - status=200, - content_type="application/json", - ) - - resp = self.client.isochrones(**query) - - self.assertEqual(1, len(responses.calls)) - self.assertEqual(resp, query) - - def test_isochrones_must_fail(self): - query = ENDPOINT_DICT["isochrones"] - query.update({"foo": {"bar": "baz"}}) - self.assertRaises(TypeError, self.client.isochrones, **query) diff --git a/test/test_isochrones_service_api.py b/test/test_isochrones_service_api.py new file mode 100644 index 00000000..8c200df3 --- /dev/null +++ b/test/test_isochrones_service_api.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: v2 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest +import configparser + +import openrouteservice +from openrouteservice.api.isochrones_service_api import IsochronesServiceApi # noqa: E501 +from openrouteservice.rest import ApiException +from openrouteservice import apiClient + + +class TestIsochronesServiceApi(unittest.TestCase): + """IsochronesServiceApi unit test stubs""" + + def setUp(self): + cfg = configparser.ConfigParser() + cfg.read('tests-config.ini') + self.api = IsochronesServiceApi(apiClient(cfg['ORS']['apiKey'])) # noqa: E501 + + def tearDown(self): + pass + + def test_get_default_isochrones(self): + """Test case for get_default_isochrones + + Isochrones Service # noqa: E501 + """ + body = openrouteservice.IsochronesProfileBody( + locations=[[8.681495,49.41461],[8.686507,49.41943]], + range=[300,200] + ) + profile = 'driving-car' + response = self.api.get_default_isochrones(body, profile) + self.assertEqual(len(response["features"]), 4) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_matrix_service_api.py b/test/test_matrix_service_api.py new file mode 100644 index 00000000..740330fd --- /dev/null +++ b/test/test_matrix_service_api.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: v2 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest +import configparser + +import openrouteservice +from openrouteservice.api.matrix_service_api import MatrixServiceApi # noqa: E501 +from openrouteservice.rest import ApiException +from openrouteservice import apiClient + +class TestMatrixServiceApi(unittest.TestCase): + """MatrixServiceApi unit test stubs""" + + def setUp(self): + cfg = configparser.ConfigParser() + cfg.read('tests-config.ini') + self.api = MatrixServiceApi(apiClient(cfg['ORS']['apiKey'])) # noqa: E501 + + def tearDown(self): + pass + + def test_get_default(self): + """Test case for get_default + + Matrix Service # noqa: E501 + """ + body = openrouteservice.MatrixProfileBody( + locations=[[9.70093,48.477473],[9.207916,49.153868],[37.573242,55.801281],[115.663757,38.106467]] + ) + profile = 'driving-car' # str | Specifies the matrix profile. + + response = self.api.get_default1(body, profile) + self.assertEqual(len(response["destinations"]), 4) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_optimization.py b/test/test_optimization.py deleted file mode 100644 index 6db710e7..00000000 --- a/test/test_optimization.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# -"""Tests for the distance matrix module.""" -import responses -import test as _test -from copy import deepcopy -import json - -from test.test_helper import * -from openrouteservice.optimization import Job, Vehicle, ShipmentStep, Shipment - - -class OptimizationTest(_test.TestCase): - def _get_params(self): - jobs, vehicles, shipments = list(), list(), list() - - for idx, coord in enumerate(PARAM_LINE): - jobs.append( - Job( - idx, - location=coord, - service=PARAM_INT_BIG, - location_index=idx, - amount=[PARAM_INT_SMALL], - skills=PARAM_LIST_ONE, - priority=PARAM_INT_SMALL, - time_windows=[PARAM_LIST_ONE], - ) - ) - - vehicles.append( - Vehicle( - idx, - profile="driving-car", - start=coord, - start_index=idx, - end=coord, - end_index=idx, - capacity=[PARAM_INT_SMALL], - skills=PARAM_LIST_ONE, - time_window=PARAM_LIST_ONE, - ) - ) - - shipments.append( - Shipment( - pickup=ShipmentStep( - idx, - location=coord, - location_index=idx, - service=PARAM_INT_BIG, - time_windows=[PARAM_LIST_ONE], - ), - delivery=ShipmentStep( - idx, - location=coord, - location_index=idx, - service=PARAM_INT_BIG, - time_windows=[PARAM_LIST_ONE], - ), - amount=[PARAM_INT_SMALL], - skills=PARAM_LIST_ONE, - priority=PARAM_INT_SMALL, - ) - ) - - return jobs, vehicles, shipments - - def test_jobs_vehicles_classes(self): - jobs, vehicles, shipments = self._get_params() - - self.assertEqual( - ENDPOINT_DICT["optimization"]["jobs"], [j.__dict__ for j in jobs] - ) - self.assertEqual( - ENDPOINT_DICT["optimization"]["vehicles"], - [v.__dict__ for v in vehicles], - ) - - @responses.activate - def test_full_optimization(self): - query = deepcopy(ENDPOINT_DICT["optimization"]) - - jobs, vehicles, shipments = self._get_params() - - responses.add( - responses.POST, - "https://api.openrouteservice.org/optimization", - json={}, - status=200, - content_type="application/json", - ) - - self.client.optimization( - jobs, vehicles, shipments, geometry=False, matrix=PARAM_LIST_TWO - ) - - self.assertEqual( - query, json.loads(responses.calls[0].request.body.decode("utf-8")) - ) diff --git a/test/test_optimization_api.py b/test/test_optimization_api.py new file mode 100644 index 00000000..2e4d3c9a --- /dev/null +++ b/test/test_optimization_api.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: v2 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest +import configparser + +import openrouteservice +from openrouteservice.api.optimization_api import OptimizationApi # noqa: E501 +from openrouteservice.rest import ApiException +from openrouteservice import apiClient + + +class TestOptimizationApi(unittest.TestCase): + """OptimizationApi unit test stubs""" + + def setUp(self): + cfg = configparser.ConfigParser() + cfg.read('tests-config.ini') + self.api = OptimizationApi(apiClient(cfg['ORS']['apiKey'])) # noqa: E501 + + def tearDown(self): + pass + + def test_optimization_post(self): + """Test case for optimization_post + + Optimization Service # noqa: E501 + """ + body = openrouteservice.OptimizationBody( + jobs=[{"id":1,"service":300,"amount":[1],"location":[1.98465,48.70329],"skills":[1],"time_windows":[[32400,36000]]},{"id":2,"service":300,"amount":[1],"location":[2.03655,48.61128],"skills":[1]},{"id":3,"service":300,"amount":[1],"location":[2.39719,49.07611],"skills":[2]},{"id":4,"service":300,"amount":[1],"location":[2.41808,49.22619],"skills":[2]},{"id":5,"service":300,"amount":[1],"location":[2.28325,48.5958],"skills":[14]},{"id":6,"service":300,"amount":[1],"location":[2.89357,48.90736],"skills":[14]}], + vehicles=[{"id":1,"profile":"driving-car","start":[2.35044,48.71764],"end":[2.35044,48.71764],"capacity":[4],"skills":[1,14],"time_window":[28800,43200]},{"id":2,"profile":"driving-car","start":[2.35044,48.71764],"end":[2.35044,48.71764],"capacity":[4],"skills":[2,14],"time_window":[28800,43200]}] + ) + response = self.api.optimization_post(body) + self.assertEqual(response["code"], 0) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_places.py b/test/test_places.py deleted file mode 100644 index 20164f3d..00000000 --- a/test/test_places.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 Google Inc. All rights reserved. -# -# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# -"""Tests for the distance matrix module.""" -import responses -import test as _test - -from test.test_helper import ENDPOINT_DICT - - -class PlacesTest(_test.TestCase): - @responses.activate - def test_pois(self): - query = ENDPOINT_DICT["pois"] - responses.add( - responses.POST, - "https://api.openrouteservice.org/pois", - json=query, - status=200, - content_type="application/json", - ) - - resp = self.client.places(**query) - - self.assertEqual(len(responses.calls), 1) - self.assertEqual(resp, query) diff --git a/test/test_pois_api.py b/test/test_pois_api.py new file mode 100644 index 00000000..2732d76b --- /dev/null +++ b/test/test_pois_api.py @@ -0,0 +1,64 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 8.0. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: v2 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest +import configparser + +import openrouteservice as ors +from openrouteservice.api.pois_api import PoisApi # noqa: E501 +from openrouteservice.rest import ApiException +from openrouteservice import apiClient + + +class TestPoisApi(unittest.TestCase): + """PoisApi unit test stubs""" + + def setUp(self): + cfg = configparser.ConfigParser() + cfg.read('tests-config.ini') + self.api = PoisApi(apiClient(cfg['ORS']['apiKey'])) # noqa: E501 + + def tearDown(self): + pass + + def test_pois_post(self): + """Test case for pois_post + + Pois Service # noqa: E501 + """ + + body = ors.OpenpoiservicePoiRequest( + request='pois', + geometry=ors.PoisGeometry( + bbox=[[8.8034,53.0756],[8.7834,53.0456]], + geojson={"type":"Point","coordinates":[8.8034,53.0756]}, + buffer=200 + ), + sortby='distance' + ) + + response = self.api.pois_post(body) + self.assertIsNotNone(response) + self.assertEqual(response["type"], "FeatureCollection") + + body.filters = ors.PoisFilters( + smoking=['yes'] + ) + + response2 = self.api.pois_post(body) + self.assertIsNotNone(response2) + self.assertGreaterEqual(len(response["features"]), len(response2["features"])) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_snapping_service_api.py b/test/test_snapping_service_api.py new file mode 100644 index 00000000..8b67510d --- /dev/null +++ b/test/test_snapping_service_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Openrouteservice + + This is the openrouteservice API documentation for ORS Core-Version 7.1.1. Documentations for [older Core-Versions](https://github.com/GIScience/openrouteservice-docs/releases) can be rendered with the [Swagger-Editor](https://editor-next.swagger.io/). # noqa: E501 + + OpenAPI spec version: 7.1.1 + Contact: support@smartmobility.heigit.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest +import configparser + +import openrouteservice +from openrouteservice.api.snapping_service_api import SnappingServiceApi # noqa: E501 +from openrouteservice.rest import ApiException +from openrouteservice import apiClient + + +class TestSnappingServiceApi(unittest.TestCase): + """SnappingServiceApi unit test stubs""" + + def setUp(self): + cfg = configparser.ConfigParser() + cfg.read('tests-config.ini') + self.api = SnappingServiceApi(apiClient(cfg['ORS']['apiKey'])) # noqa: E501 + + def tearDown(self): + pass + + def test_get_default(self): + """Test case for get_default + + Snapping Service # noqa: E501 + """ + # response = self.api.get_default() + # self.assertIsNotNone(response) + + def test_get_geo_json_snapping(self): + """Test case for get_geo_json_snapping + + Snapping Service GeoJSON # noqa: E501 + """ + # response = self.api.get_geo_json_snapping() + # self.assertIsNotNone(response) + + def test_get_json_snapping(self): + """Test case for get_json_snapping + + Snapping Service JSON # noqa: E501 + """ + # response = self.api.get_json_snapping() + # self.assertIsNotNone(response) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests-config.ini b/tests-config.ini new file mode 100644 index 00000000..687d42a3 --- /dev/null +++ b/tests-config.ini @@ -0,0 +1,2 @@ +[ORS]\n +apiKey = 5b3ce3597851110001cf624825699ac758834a3488254c37444a8a92\n diff --git a/tests-config.sample.ini b/tests-config.sample.ini new file mode 100644 index 00000000..5bedef82 --- /dev/null +++ b/tests-config.sample.ini @@ -0,0 +1,2 @@ +[ORS] +apiKey = YOUR_API_KEY \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..c6379fa9 --- /dev/null +++ b/tox.ini @@ -0,0 +1,15 @@ +[tox] +env_list = pytest-{py38,py39,py310,py311} + +[testenv:pytest-{py37,py38,py39,py310,py311}] +base_python = + py38: python3.8 + py39: python3.9 + py310: python3.10 + py311: python3.11 +commands = + poetry install -v --no-interaction --no-root + pytest --cov=openrouteservice --cov-report xml --cov-report term-missing --cov-fail-under 50 -n auto +allowlist_externals = + poetry + pytest