Integrate A-to-B route planning, turn-by-turn navigation, route optimization, isochrone calculations, location clustering and other tools into your application.
Authenticate to the API by passing your key as a query parameter in every request.
You can also try all API parts without registration in our API explorer.
To speed up development and make coding easier, we offer a JavaScript client and a Java client.
- Reuse SSL/TLS sessions
You should utilize the SSL session to speed up responses after the initial response or use a library that does this. E.g. for Java the
OkHttp library automatically reuses SSL/TLS sessions and also the browser takes care of this automatically.
For python you can use the requests library: first you create a
session (session = requests.Session()) and then do requests only with this session instead of directly using "requests".
- Bandwidth reduction
If you create your own client, make sure it supports http/2 and gzipped responses for best speed.
If you use the Matrix, the Route Optimization API or the and want to solve large problems, we recommend you to reduce bandwidth
by compressing your POST request and specifying the header
as follows: Content-Encoding: gzip. This will also avoid the HTTP 413 error "Request Entity Too Large".
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 1.0.0
- Package version: 1.0.0
- Generator version: 7.12.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.graphhopper.com/
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/contextPut the package under your project folder and add the following in import:
import openapi "github.com/meission/go-graphhopper"To use a proxy, set the environment variable HTTP_PROXY:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value openapi.ContextServerIndex of type int.
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables of type map[string]string.
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
"basePath": "v2",
})Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers map in the Configuration.
An operation is uniquely identified by "{classname}Service.{nickname}" string.
Similar rules for overriding default operation server index and variables applies by using openapi.ContextOperationServerIndices and openapi.ContextOperationServerVariables context maps.
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})All URIs are relative to https://graphhopper.com/api/1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| ClusteringAPI | AsyncClusteringProblem | Post /cluster/calculate | Batch Cluster Endpoint |
| ClusteringAPI | GetClusterSolution | Get /cluster/solution/{jobId} | GET Batch Solution Endpoint |
| ClusteringAPI | SolveClusteringProblem | Post /cluster | POST Cluster Endpoint |
| CustomProfilesAPI | DeleteProfile | Delete /profiles/{profileId} | Delete a custom routing profile |
| CustomProfilesAPI | GetProfile | Get /profiles | List your custom routing profiles |
| CustomProfilesAPI | PostProfile | Post /profiles | Create a custom routing profile |
| GeocodingAPI | GetGeocode | Get /geocode | Geocoding Endpoint |
| IsochronesAPI | GetIsochrone | Get /isochrone | Compute an isochrone |
| MapMatchingAPI | PostGPX | Post /match | Map-match a GPX file |
| MatricesAPI | CalculateMatrix | Post /matrix/calculate | Submit a matrix computation job |
| MatricesAPI | GetMatrix | Get /matrix | Compute a matrix |
| MatricesAPI | GetMatrixSolution | Get /matrix/solution/{jobId} | Retrieve result of a matrix computation job |
| MatricesAPI | PostMatrix | Post /matrix | Compute a matrix |
| RouteOptimizationAPI | AsyncVRP | Post /vrp/optimize | Submit a route optimization job |
| RouteOptimizationAPI | GetSolution | Get /vrp/solution/{jobId} | Retrieve solution of a route optimization job |
| RouteOptimizationAPI | SolveVRP | Post /vrp | Solve a route optimization problem |
| RoutingAPI | GetRoute | Get /route | Calculate a route |
| RoutingAPI | PostRoute | Post /route | Calculate a route |
- Activity
- Address
- Algorithm
- BBox
- BadRequest
- Cluster
- ClusterConfiguration
- ClusterConfigurationClustering
- ClusterConfigurationRouting
- ClusterCustomer
- ClusterCustomerAddress
- ClusterRequest
- ClusterResponse
- Clusters
- Configuration
- CostMatrix
- CostMatrixData
- CostMatrixDataInfo
- CustomModel
- CustomModelForProfile
- Detail
- DriveTimeBreak
- ErrorMessage
- FeatureCollection
- FeatureCollectionFeaturesInner
- GHError
- GHErrorHintsInner
- GeocodingLocation
- GeocodingPoint
- GeocodingResponse
- GetMatrixSolution200Response
- GetSolution404Response
- GroupRelation
- InternalErrorMessage
- IsochroneResponse
- IsochroneResponsePolygon
- IsochroneResponsePolygonProperties
- JobId
- JobRelation
- LineString
- MatrixRequest
- MatrixResponse
- MatrixResponseHintsInner
- Objective
- Optimization
- Polygon
- PostMatrixRequest
- PreferredVehicle
- ProfileGetResponse
- ProfileRequest
- ProfileRequestBounds
- ProfileResponse
- ProfileResponseBounds
- Request
- RequestRelationsInner
- Response
- ResponseAddress
- ResponseInfo
- Route
- RoutePoint
- RouteRequest
- RouteResponse
- RouteResponsePath
- RouteResponsePathInstructionsInner
- RouteResponsePathPoints
- RouteResponsePathSnappedWaypoints
- Routing
- Service
- Shift
- Shipment
- SnappedWaypoint
- Solution
- SolutionUnassigned
- Stop
- SymmetricalMatrixRequest
- TimeWindow
- TimeWindowBreak
- Vehicle
- VehicleBreak
- VehicleType
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: key
- Location: URL query string
Note, each API key must be added to a map of map[string]APIKey where the key is: api_key and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"api_key": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBoolPtrIntPtrInt32PtrInt64PtrFloatPtrFloat32PtrFloat64PtrStringPtrTime