|
| 1 | +# openrouteservice |
| 2 | +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. |
| 3 | + |
| 4 | +| API Version | Package version | Build package | |
| 5 | +| -------------- | ------------------ | ------------------ | |
| 6 | +| 7.1.0 | 7.1.0.post6 | io.swagger.codegen.v3.generators.python.PythonClientCodegen | |
| 7 | + |
| 8 | +For further details, please visit: |
| 9 | +- our [homepage](https://openrouteservice.org) |
| 10 | +- [ORS API documentation](https://openrouteservice.org/documentation/) |
| 11 | + |
| 12 | +For support, please ask our [forum](https://ask.openrouteservice.org/c/sdks). |
| 13 | +By using this library, you agree to the ORS [terms and conditions](https://openrouteservice.org/terms-of-service/). |
| 14 | + |
| 15 | +## Requirements. |
| 16 | + |
| 17 | +Python 2.7 and 3.4+ |
| 18 | + |
| 19 | +## Installation & Usage |
| 20 | +### pip install |
| 21 | + |
| 22 | +If the python package is hosted on Github, you can install directly from Github |
| 23 | + |
| 24 | +```sh |
| 25 | +pip install ors-py |
| 26 | +``` |
| 27 | + |
| 28 | +Then import the package: |
| 29 | +```python |
| 30 | +import openrouteservice |
| 31 | +``` |
| 32 | + |
| 33 | +### Setuptools |
| 34 | + |
| 35 | +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). |
| 36 | + |
| 37 | +```sh |
| 38 | +python setup.py install --user |
| 39 | +``` |
| 40 | +(or `sudo python setup.py install` to install the package for all users) |
| 41 | + |
| 42 | +Then import the package: |
| 43 | +```python |
| 44 | +import openrouteservice |
| 45 | +``` |
| 46 | + |
| 47 | +## Usage |
| 48 | +Please follow the [installation procedure](#installation--usage) before running the examples: |
| 49 | + |
| 50 | +### Examples |
| 51 | +These examples show common usages of this library. |
| 52 | +- [Avoid construction sites dynamically](docs/examples/Avoid_ConstructionSites) |
| 53 | +- [Dieselgate Routing](docs/examples/Dieselgate_Routing) |
| 54 | +- [Route optimization of pub crawl](docs/examples/ortools_pubcrawl) |
| 55 | +- [Routing optimization in humanitarian context](docs/examples/Routing_Optimization_Idai) |
| 56 | + |
| 57 | +### Basic example |
| 58 | +```python |
| 59 | +import openrouteservice as ors |
| 60 | +from pprint import pprint |
| 61 | + |
| 62 | +# Configure API key authorization: |
| 63 | +configuration = ors.Configuration() |
| 64 | +configuration.api_key['Authorization'] = "YOUR_API_KEY" |
| 65 | + |
| 66 | +# create an instance of the API class |
| 67 | +directionsApi = ors.DirectionsServiceApi(ors.ApiClient(configuration)) |
| 68 | + |
| 69 | +# create request body |
| 70 | +body = ors.DirectionsService( |
| 71 | + coordinates=[[8.34234,48.23424],[8.34423,48.26424]] |
| 72 | +) |
| 73 | + |
| 74 | +profile = 'driving-car' |
| 75 | + |
| 76 | +try: |
| 77 | + routes = directionsApi.get_geo_json_route(body, profile) |
| 78 | + pprint(routes) |
| 79 | +except ors.rest.ApiException as e: |
| 80 | + print("Exception when calling DirectionsServiceApi->get_geo_json_route: %s\n" % e) |
| 81 | +``` |
| 82 | + |
| 83 | +### Local ORS instance |
| 84 | +```python |
| 85 | +import openrouteservice as ors |
| 86 | +from pprint import pprint |
| 87 | + |
| 88 | +# Configure host |
| 89 | +configuration = ors.Configuration() |
| 90 | +configuration.host = "http://localhost:8080/ors" |
| 91 | + |
| 92 | +isochronesApi = ors.IsochronesServiceApi(ors.ApiClient(configuration)) |
| 93 | +body = ors.IsochronesProfileBody( |
| 94 | + locations=[[8.681495,49.41461],[8.686507,49.41943]], |
| 95 | + range=[300] |
| 96 | +) |
| 97 | +profile = 'driving-car' # Specifies the route profile. |
| 98 | + |
| 99 | +try: |
| 100 | + api_response = isochronesApi.get_default_isochrones(body, profile) |
| 101 | + pprint(api_response) |
| 102 | +except ors.rest.ApiException as e: |
| 103 | + print("Exception when calling IsochronesServiceApi->get_default_isochrones: %s\n" % e) |
| 104 | +``` |
| 105 | + |
| 106 | +## Documentation for API Endpoints |
| 107 | + |
| 108 | +All URIs are relative to *https://api.openrouteservice.org* |
| 109 | + |
| 110 | +Class | Method | HTTP request | Description |
| 111 | +------------ | ------------- | ------------- | ------------- |
| 112 | +*DirectionsServiceApi* | [**get_geo_json_route**](docs/DirectionsServiceApi.md#get_geo_json_route) | **POST** /v2/directions/{profile}/geojson | Directions Service GeoJSON |
| 113 | +*DirectionsServiceApi* | [**get_json_route**](docs/DirectionsServiceApi.md#get_json_route) | **POST** /v2/directions/{profile}/json | Directions Service JSON |
| 114 | +*ElevationApi* | [**elevation_line_post**](docs/ElevationApi.md#elevation_line_post) | **POST** /elevation/line | Elevation Line Service |
| 115 | +*ElevationApi* | [**elevation_point_get**](docs/ElevationApi.md#elevation_point_get) | **GET** /elevation/point | Elevation Point Service |
| 116 | +*ElevationApi* | [**elevation_point_post**](docs/ElevationApi.md#elevation_point_post) | **POST** /elevation/point | Elevation Point Service |
| 117 | +*GeocodeApi* | [**geocode_autocomplete_get**](docs/GeocodeApi.md#geocode_autocomplete_get) | **GET** /geocode/autocomplete | Geocode Autocomplete Service |
| 118 | +*GeocodeApi* | [**geocode_reverse_get**](docs/GeocodeApi.md#geocode_reverse_get) | **GET** /geocode/reverse | Reverse Geocode Service |
| 119 | +*GeocodeApi* | [**geocode_search_get**](docs/GeocodeApi.md#geocode_search_get) | **GET** /geocode/search | Forward Geocode Service |
| 120 | +*GeocodeApi* | [**geocode_search_structured_get**](docs/GeocodeApi.md#geocode_search_structured_get) | **GET** /geocode/search/structured | Structured Forward Geocode Service (beta) |
| 121 | +*IsochronesServiceApi* | [**get_default_isochrones**](docs/IsochronesServiceApi.md#get_default_isochrones) | **POST** /v2/isochrones/{profile} | Isochrones Service |
| 122 | +*MatrixServiceApi* | [**get_default**](docs/MatrixServiceApi.md#get_default) | **POST** /v2/matrix/{profile} | Matrix Service |
| 123 | +*OptimizationApi* | [**optimization_post**](docs/OptimizationApi.md#optimization_post) | **POST** /optimization | Optimization Service |
| 124 | +*PoisApi* | [**pois_post**](docs/PoisApi.md#pois_post) | **POST** /pois | Pois Service |
| 125 | + |
| 126 | +## Documentation For Models |
| 127 | + |
| 128 | + - [AlternativeRoutes](docs/AlternativeRoutes.md) |
| 129 | + - [DirectionsService](docs/DirectionsService.md) |
| 130 | + - [DirectionsService1](docs/DirectionsService1.md) |
| 131 | + - [ElevationLineBody](docs/ElevationLineBody.md) |
| 132 | + - [ElevationPointBody](docs/ElevationPointBody.md) |
| 133 | + - [EngineInfo](docs/EngineInfo.md) |
| 134 | + - [GeoJSONFeaturesObject](docs/GeoJSONFeaturesObject.md) |
| 135 | + - [GeoJSONGeometryObject](docs/GeoJSONGeometryObject.md) |
| 136 | + - [GeoJSONIsochroneBase](docs/GeoJSONIsochroneBase.md) |
| 137 | + - [GeoJSONIsochroneBaseGeometry](docs/GeoJSONIsochroneBaseGeometry.md) |
| 138 | + - [GeoJSONIsochronesResponse](docs/GeoJSONIsochronesResponse.md) |
| 139 | + - [GeoJSONIsochronesResponseFeatures](docs/GeoJSONIsochronesResponseFeatures.md) |
| 140 | + - [GeoJSONIsochronesResponseMetadata](docs/GeoJSONIsochronesResponseMetadata.md) |
| 141 | + - [GeoJSONIsochronesResponseMetadataEngine](docs/GeoJSONIsochronesResponseMetadataEngine.md) |
| 142 | + - [GeoJSONPropertiesObject](docs/GeoJSONPropertiesObject.md) |
| 143 | + - [GeoJSONPropertiesObjectCategoryIds](docs/GeoJSONPropertiesObjectCategoryIds.md) |
| 144 | + - [GeoJSONPropertiesObjectCategoryIdsCategoryId](docs/GeoJSONPropertiesObjectCategoryIdsCategoryId.md) |
| 145 | + - [GeoJSONPropertiesObjectOsmTags](docs/GeoJSONPropertiesObjectOsmTags.md) |
| 146 | + - [GeoJSONRouteResponse](docs/GeoJSONRouteResponse.md) |
| 147 | + - [GeoJSONRouteResponseMetadata](docs/GeoJSONRouteResponseMetadata.md) |
| 148 | + - [GeocodeResponse](docs/GeocodeResponse.md) |
| 149 | + - [Gpx](docs/Gpx.md) |
| 150 | + - [GraphExportService](docs/GraphExportService.md) |
| 151 | + - [InlineResponse200](docs/InlineResponse200.md) |
| 152 | + - [InlineResponse2001](docs/InlineResponse2001.md) |
| 153 | + - [InlineResponse2001Geometry](docs/InlineResponse2001Geometry.md) |
| 154 | + - [InlineResponse2002](docs/InlineResponse2002.md) |
| 155 | + - [InlineResponse2002Routes](docs/InlineResponse2002Routes.md) |
| 156 | + - [InlineResponse2002Steps](docs/InlineResponse2002Steps.md) |
| 157 | + - [InlineResponse2002Summary](docs/InlineResponse2002Summary.md) |
| 158 | + - [InlineResponse2002Unassigned](docs/InlineResponse2002Unassigned.md) |
| 159 | + - [InlineResponse2003](docs/InlineResponse2003.md) |
| 160 | + - [InlineResponse2004](docs/InlineResponse2004.md) |
| 161 | + - [InlineResponse2005](docs/InlineResponse2005.md) |
| 162 | + - [InlineResponse2006](docs/InlineResponse2006.md) |
| 163 | + - [InlineResponse200Geometry](docs/InlineResponse200Geometry.md) |
| 164 | + - [IsochronesProfileBody](docs/IsochronesProfileBody.md) |
| 165 | + - [IsochronesRequest](docs/IsochronesRequest.md) |
| 166 | + - [IsochronesResponseInfo](docs/IsochronesResponseInfo.md) |
| 167 | + - [JSON2DDestinations](docs/JSON2DDestinations.md) |
| 168 | + - [JSON2DSources](docs/JSON2DSources.md) |
| 169 | + - [JSONExtra](docs/JSONExtra.md) |
| 170 | + - [JSONExtraSummary](docs/JSONExtraSummary.md) |
| 171 | + - [JSONIndividualRouteResponse](docs/JSONIndividualRouteResponse.md) |
| 172 | + - [JSONIndividualRouteResponseExtras](docs/JSONIndividualRouteResponseExtras.md) |
| 173 | + - [JSONIndividualRouteResponseInstructions](docs/JSONIndividualRouteResponseInstructions.md) |
| 174 | + - [JSONIndividualRouteResponseLegs](docs/JSONIndividualRouteResponseLegs.md) |
| 175 | + - [JSONIndividualRouteResponseManeuver](docs/JSONIndividualRouteResponseManeuver.md) |
| 176 | + - [JSONIndividualRouteResponseSegments](docs/JSONIndividualRouteResponseSegments.md) |
| 177 | + - [JSONIndividualRouteResponseStops](docs/JSONIndividualRouteResponseStops.md) |
| 178 | + - [JSONIndividualRouteResponseSummary](docs/JSONIndividualRouteResponseSummary.md) |
| 179 | + - [JSONIndividualRouteResponseWarnings](docs/JSONIndividualRouteResponseWarnings.md) |
| 180 | + - [JSONLeg](docs/JSONLeg.md) |
| 181 | + - [JSONObject](docs/JSONObject.md) |
| 182 | + - [JSONPtStop](docs/JSONPtStop.md) |
| 183 | + - [JSONRouteResponse](docs/JSONRouteResponse.md) |
| 184 | + - [JSONRouteResponseRoutes](docs/JSONRouteResponseRoutes.md) |
| 185 | + - [JSONSegment](docs/JSONSegment.md) |
| 186 | + - [JSONStep](docs/JSONStep.md) |
| 187 | + - [JSONStepManeuver](docs/JSONStepManeuver.md) |
| 188 | + - [JSONSummary](docs/JSONSummary.md) |
| 189 | + - [JSONWarning](docs/JSONWarning.md) |
| 190 | + - [JsonEdge](docs/JsonEdge.md) |
| 191 | + - [JsonEdgeExtra](docs/JsonEdgeExtra.md) |
| 192 | + - [JsonExportResponse](docs/JsonExportResponse.md) |
| 193 | + - [JsonExportResponseEdges](docs/JsonExportResponseEdges.md) |
| 194 | + - [JsonExportResponseEdgesExtra](docs/JsonExportResponseEdgesExtra.md) |
| 195 | + - [JsonExportResponseNodes](docs/JsonExportResponseNodes.md) |
| 196 | + - [JsonNode](docs/JsonNode.md) |
| 197 | + - [MatrixProfileBody](docs/MatrixProfileBody.md) |
| 198 | + - [MatrixRequest](docs/MatrixRequest.md) |
| 199 | + - [MatrixResponse](docs/MatrixResponse.md) |
| 200 | + - [MatrixResponseDestinations](docs/MatrixResponseDestinations.md) |
| 201 | + - [MatrixResponseInfo](docs/MatrixResponseInfo.md) |
| 202 | + - [MatrixResponseMetadata](docs/MatrixResponseMetadata.md) |
| 203 | + - [MatrixResponseSources](docs/MatrixResponseSources.md) |
| 204 | + - [OpenpoiservicePoiRequest](docs/OpenpoiservicePoiRequest.md) |
| 205 | + - [OpenpoiservicePoiResponse](docs/OpenpoiservicePoiResponse.md) |
| 206 | + - [OptimizationBody](docs/OptimizationBody.md) |
| 207 | + - [OptimizationJobs](docs/OptimizationJobs.md) |
| 208 | + - [OptimizationOptions](docs/OptimizationOptions.md) |
| 209 | + - [OptimizationVehicles](docs/OptimizationVehicles.md) |
| 210 | + - [PoisFilters](docs/PoisFilters.md) |
| 211 | + - [PoisGeometry](docs/PoisGeometry.md) |
| 212 | + - [ProfileParameters](docs/ProfileParameters.md) |
| 213 | + - [ProfileParametersRestrictions](docs/ProfileParametersRestrictions.md) |
| 214 | + - [ProfileWeightings](docs/ProfileWeightings.md) |
| 215 | + - [Restrictions](docs/Restrictions.md) |
| 216 | + - [RoundTripRouteOptions](docs/RoundTripRouteOptions.md) |
| 217 | + - [RouteOptions](docs/RouteOptions.md) |
| 218 | + - [RouteOptionsAvoidPolygons](docs/RouteOptionsAvoidPolygons.md) |
| 219 | + - [RouteResponseInfo](docs/RouteResponseInfo.md) |
| 220 | + - [Rte](docs/Rte.md) |
| 221 | + - [V2directionsprofilegeojsonScheduleDuration](docs/V2directionsprofilegeojsonScheduleDuration.md) |
| 222 | + - [V2directionsprofilegeojsonScheduleDurationDuration](docs/V2directionsprofilegeojsonScheduleDurationDuration.md) |
| 223 | + - [V2directionsprofilegeojsonScheduleDurationUnits](docs/V2directionsprofilegeojsonScheduleDurationUnits.md) |
| 224 | + - [V2directionsprofilegeojsonWalkingTime](docs/V2directionsprofilegeojsonWalkingTime.md) |
| 225 | + |
| 226 | +## Author |
| 227 | + |
| 228 | +support@smartmobility.heigit.org |
0 commit comments