Giter Club home page Giter Club logo

directions-api's Introduction

GraphHopper Routing Engine

Build Status

GraphHopper is a fast and memory-efficient routing engine released under Apache License 2.0. It can be used as a Java library or standalone web server to calculate the distance, time, turn-by-turn instructions and many road attributes for a route between two or more points. Beyond this "A-to-B" routing it supports "snap to road", Isochrone calculation, mobile navigation and more. GraphHopper uses OpenStreetMap and GTFS data by default and it can import other data sources too.

Community

We have an open community and welcome everyone. Let us know your problems, use cases or just say hello. Please see our community guidelines.

Questions

All questions go to our forum where we also have subsections specially for developers, mobile usage, and our map matching component. You can also search Stackoverflow for answers.

Contribute

Read through our contributing guide for information on topics like finding and fixing bugs and improving our documentation or translations! We also have good first issues to get started with contribution.

Get Started

To get started you can try GraphHopper Maps, read through our documentation and install GraphHopper including the Maps UI locally.

Click to see older releases

Installation

To install the GraphHopper Maps UI and the web service locally you need a JVM (>= Java 17) and do:

wget https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/9.1/graphhopper-web-9.1.jar https://raw.githubusercontent.com/graphhopper/graphhopper/9.x/config-example.yml http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
java -D"dw.graphhopper.datareader.file=berlin-latest.osm.pbf" -jar graphhopper*.jar server config-example.yml

After a while you see a log message with 'Server - Started', then go to http://localhost:8989/ and you'll see a map of Berlin. You should be able to right click on the map to create a route.

See the documentation that contains e.g. the elevation guide and the deployment guide.

Docker

The Docker images created by the community from the master branch can be found here (currently daily). See the Dockerfile for more details.

GraphHopper Maps

To see the road routing feature of GraphHopper in action please go to GraphHopper Maps.

GraphHopper Maps

GraphHopper Maps is an open source user interface, which you can find here. It can use this open source routing engine or the GraphHopper Directions API, which provides the Routing API, a Route Optimization API (based on jsprit), a fast Matrix API and an address search (based on photon). The photon project is also supported by the GraphHopper GmbH. Additionally to the GraphHopper Directions API, map tiles from various providers are used, with the default being Omniscale.

All this is available for free, via encrypted connections and from German servers - for a nice and private route planning experience!

Public Transit

Get started

Realtime Demo

Mobile Apps

Online

There is a web service that can be consumed by our navigation Android client.

Offline

Offline routing is no longer officially supported but should still work as Android supports most of Java. See version 1.0 with the Android demo and also see this pull request of the iOS fork including a demo for iOS.

Analysis

Use isochrones to calculate and visualize the reachable area for a certain travel mode.

You can try the debug user interface at http://localhost:8989/maps/isochrone to see the /isochrone and /spt endpoint in action.

Isochrone API image

high precision reachability image

There is the map matching subproject to snap GPX traces to the road.

map-matching-example

Technical Overview

GraphHopper supports several routing algorithms, such as Dijkstra and A* and its bidirectional variants. Furthermore, it allows you to use Contraction Hierarchies (CH) very easily. We call this speed mode; without this CH preparation, we call it flexible mode.

The speed mode comes with very fast and lightweight (less RAM) responses and it does not use heuristics. However, only predefined vehicle profiles are possible and this additional CH preparation is time and resource consuming.

Then there is the hybrid mode which also requires more time and memory for the preparation, but it is much more flexible regarding changing properties per request or e.g. integrating traffic data. Furthermore, this hybrid mode is slower than the speed mode, but it is an order of magnitude faster than the flexible mode and uses less RAM for one request.

If the preparations exist you can switch between all modes at request time.

Read more about the technical details here.

License

We chose the Apache License to make it easy for you to embed GraphHopper in your products, even closed source. We suggest that you contribute back your changes, as GraphHopper evolves fast.

OpenStreetMap Support

OpenStreetMap is directly supported by GraphHopper. Without the amazing data from OpenStreetMap, GraphHopper wouldn't be possible at all. Other map data will need a custom import procedure, see e.g. Ordnance Survey, Shapefile like ESRI or Navteq.

Written in Java

GraphHopper is written in Java and officially runs on Linux, Mac OS X and Windows.

Maven

Embed GraphHopper with OpenStreetMap support into your Java application via the following snippet:

<dependency>
    <groupId>com.graphhopper</groupId>
    <artifactId>graphhopper-core</artifactId>
    <version>[LATEST-VERSION]</version>
</dependency>

See our example application to get started fast.

Customizable

You can customize GraphHopper with Java knowledge (with a high and low level API) and also without Java knowledge using the custom models.

Web API

With the web module, we provide code to query GraphHopper over HTTP and decrease bandwidth usage as much as possible. For that we use an efficient polyline encoding, the Ramer–Douglas–Peucker algorithm, and a simple GZIP servlet filter.

On the client side, we provide a Java and JavaScript client.

Desktop

GraphHopper also runs on the Desktop in a Java application without internet access. For debugging purposes GraphHopper can produce vector tiles, i.e. a visualization of the road network in the browser (see #1572). Also a more low level Swing-based UI is provided via MiniGraphUI in the tools module, see some visualizations done with it here. A fast and production-ready map visualization for the Desktop can be implemented via mapsforge or mapsforge vtm.

Features

  • Works out of the box with OpenStreetMap (osm/xml and pbf) and can be adapted to custom data
  • OpenStreetMap integration: stores and considers road type, speed limit, the surface, barriers, access restrictions, ferries, conditional access restrictions and more
  • GraphHopper is fast. And with the so called "Contraction Hierarchies" it can be even faster (enabled by default).
  • Memory efficient data structures, algorithms and the low and high level API is tuned towards ease of use and efficiency
  • Pre-built routing profiles: car, bike, racing bike, mountain bike, foot, hike, truck, bus, motorcycle, ...
  • Customization of these profiles are possible. Read about it here.
  • Provides a powerful web API that exposes the data from OpenStreetMap and allows customizing the vehicle profiles per request. With JavaScript and Java clients.
  • Provides map matching i.e. "snap to road".
  • Supports time-dependent public transit routing and reading GTFS.
  • Offers turn instructions in more than 45 languages. Contribute or improve here.
  • Displays and takes into account elevation data.
  • Supports alternative routes.
  • Supports turn costs and restrictions.
  • Offers country-specific routing via country rules.
  • Allows customizing routing behavior using custom areas.
  • The core uses only a few dependencies (hppc, jts, janino and slf4j).
  • Scales from small indoor-sized to world-wide-sized graphs.
  • Finds nearest point on street e.g. to get elevation or 'snap to road' or being used as spatial index (see #1485).
  • Calculates isochrones and shortest path trees.
  • Shows the whole road network in the browser for debugging purposes ("vector tile support"), see #1572.
  • Shows so called "path details" along a route like road_class or max_speed, see #1142 or the web documentation.
  • Written in Java and simple to start for developers via Maven.

directions-api's People

Contributors

boldtrn avatar breyed avatar karussell avatar oblonski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

directions-api's Issues

Supported vehicle types in "info" endpoint

It would be nice to know, before sending a routing request to the API, what vehicle types are allowed with our API key. Some GraphHopper account types don't have access to all vehicle types, e.g. free accounts have access only to car, foot and bike.

Currently, there is no way to programmatically know if, say, mtb vehicle will be allowed, other than issuing a routing API call and check if it returns an error or not.

From the documentation:

features A json object per supported vehicles with name and supported features like elevation

It is not clear if "supported" refers to the API system itself, or to my specific key used to call the info endpoint.

Currently, all vehicle types supported by the API are returned, regardless of the given API key.

Expected:
Either only vehicle types supported by the key are returned.
Or a new key is created and returned, telling about allowed vehicles types for the given key.

In all cases, the documentation should be updated and made clear.

Geocoding issues

Question:
If we search for a street name including house number, why is it not included in the search suggestions?

Answer:
Our address search is really dependent on good data and although in central Europe the data is really good it is not yet perfect, especially for house number precision. But regarding your specific example (hidden exampe) it seems that our software is to blame, not the data. We will investigate

Geocoding API update

The Geocoding API gets an improvement regarding

  • the data freshness
  • the location bias is stronger
  • reverse geocoding will work, to be documented

Keep us informed if something got worse for your results! And of course also let us know if it is better :)

Truck Routing

We've implemented a first version for truck routing, ie. a vehicle considering weight, height and width access restrictions as long as these properties are available in the OpenStreetMap data (can be added fast). The specific truck properties are published here, the bus profile is not a 'public transportation' bus, instead it is a truck with the properties of a bus and can be used as an overland bus. A customized version is currently only possible via a customized package or self-hosted version.

We'll improve especially the ETAs in the coming months at the same time where we improve it for the other vehicles.

Feature: Api Key Renaming

It would be nice if a created API key would be renameable. Workaround would be to create a new one. So not really a pressing issue.

Maximum locations per request in "info" endpoint

It would be nice to know, before sending a routing request to the API, what is the maximum locations per request allowed with our API key. This number varies with GraphHopper account types. E.g. 5 with Free accounts, 30 with Basic accounts, etc.

Currently, there is no way to programmatically know if my routing query with n locations will be allowed, other than issuing it and check if it returns an error or not.

My first use case is the GraphHopper Maps UI. Creating a new intermediate point could be disabled once the maximum allowed count of intermediate points is reached.

E.g. if using a free account (max. 5 locations: start, end and 3 intermediates), and you already defined 3 intermediate points, then the + icon in the left margin to add a new location would be disabled, as well as the "Add intermediate point" item in the context menu.

You should create and return a new key max_locations in the answer to the info endpoint calls.

My daily credits limit doesn't reset every day. What is wrong?

Currently the daily credit limit is a 'rolling limit' and resets when you use it. E.g. if started on 6pm with querying then the limit is reset on the next day if a request comes in at 6pm or later.

You can always see the reset date and remaining credits when reading the header of one request, see here for more information.

Support for Open Location Code

We should not only support GPS coordinates but also open location code from Google. Standing under Apache License. See here for a good comparison where open location code stands out from its logical point of view and being pure algorithmic based as well as the code license.

We need to clarify

An alternative would be https://github.com/roberdam/Xaddress

valid geojson response

Hi,

i was wondering how do i transform the default answer to a valid geojson?

beacuse neither leaflet or geojson.io understand a the answer using Routing API

example:

curl "https://graphhopper.com/api/1/route?point=-34.608053,-58.459734&point=-34.709718,-58.675684&vehicle=car&locale=es&debug=false&points_encoded=false&key=[mykey]" > line_answer

and my answer:

{"hints":{"visited_nodes.average":"719.0","visited_nodes.sum":"719"},
"paths":[{"instructions":[{"distance":235.097,"sign":0,"interval":[0,2],"text":"Continúe por Tres Arroyos","time":28210},{"distance":256.685,"sign":2,"interval":[2,4],"text":"Gire a la derecha por Av. Donato Álvarez","time":16800},{"distance":12.651,"sign":0,"interval":[4,6],"text":"Continúe por Avenida Donato Álvarez","time":1518},{"distance":894.698,"sign":-3,"interval":[6,16],"text":"Gire fuerte a la izquierda por Av. Juan Bautista Justo","time":53677},{"distance":3121.167,"sign":0,"interval":[16,37],"text":"Continúe por Avenida Juan Bautista Justo","time":189843},{"distance":2347.822,"sign":0,"interval":[37,62],"text":"Continúe por Av. Juan Bautista Justo","time":140859},{"exit_number":2,"distance":439.091,"sign":6,"turn_angle":-3.78,"interval":[62,73],"text":"En la rotonda, tome la 2ª salida hacia Av. Juan Bautista Justo","time":26344},{"distance":174.707,"sign":-2,"interval":[73,76],"text":"Gire a la izquierda por Gallardo","time":17969},{"distance":216.227,"sign":1,"interval":[76,82],"text":"Gire leve a la derecha por Subida Gallardo","time":11120},{"distance":356.606,"sign":0,"interval":[82,87],"text":"Continúe por Autopista Perito Moreno, AU6","time":13386},{"distance":7235.256,"sign":0,"interval":[87,122],"text":"Continúe por Acceso Oeste, RN7","time":229805},{"distance":389.804,"sign":0,"interval":[122,128],"text":"Continúe","time":20047},{"distance":275.799,"sign":-2,"interval":[128,132],"text":"Gire a la izquierda por Presidente Derqui","time":16545},{"distance":1290.526,"sign":0,"interval":[132,143],"text":"Continúe por Doctor Ricardo Balbín","time":77427},{"distance":631.037,"sign":0,"interval":[143,146],"text":"Continúe por Mendoza","time":37859},{"distance":1364.12,"sign":0,"interval":[146,150],"text":"Continúe por General José de San Martín","time":81841},{"distance":237.971,"sign":2,"interval":[150,152],"text":"Gire a la derecha por Hipólito Yrigoyen, RP4","time":13178},{"distance":18.906,"sign":-3,"interval":[152,153],"text":"Gire fuerte a la izquierda por Humberto Primo","time":1134},{"distance":963.078,"sign":2,"interval":[153,159],"text":"Gire a la derecha por Avenida Eva Perón, RP17","time":63032},{"distance":2422.63,"sign":0,"interval":[159,167],"text":"Continúe por Av. Eva Perón, RP17","time":134167},{"distance":374.264,"sign":0,"interval":[167,170],"text":"Continúe por Av. Eva Perón","time":22454},{"distance":26.786,"sign":0,"interval":[170,172],"text":"Continúe","time":1928},{"distance":1142.956,"sign":0,"interval":[172,185],"text":"Continúe por Av. Callao, 101-02","time":68570},{"distance":2893.336,"sign":0,"interval":[185,205],"text":"Continúe por Av. Bella Vista","time":173580},{"distance":274.337,"sign":-2,"interval":[205,207],"text":"Gire a la izquierda por Honduras","time":32919},{"distance":0,"sign":4,"interval":[207,207],"text":"¡Fin del recorrido!","time":0}],
"distance":27595.557,"bbox":[-58.677397,-34.709342,-58.459477,-34.607298],"weight":27595.557199,"time":1474212,"points_encoded":false,
"points":{"coordinates":[[-58.459477,-34.608392],[-58.46076,-34.60905],[-58.461634,-34.60954],[-58.462208,-34.60838],[-58.462681,-34.607399],[-58.462705,-34.607367],[-58.462745,-34.607298],[-58.463931,-34.608128],[-58.464437,-34.608504],[-58.464902,-34.609003],[-58.465418,-34.609588],[-58.46567,-34.609907],[-58.466006,-34.610224],[-58.467904,-34.61125],[-58.469019,-34.611871],[-58.469581,-34.612164],[-58.470126,-34.61244],[-58.471269,-34.613016],[-58.471966,-34.613417],[-58.472316,-34.61378],[-58.473557,-34.615593],[-58.473828,-34.615837],[-58.474707,-34.616355],[-58.474922,-34.616536],[-58.475258,-34.616949],[-58.477133,-34.6191],[-58.47896,-34.620076],[-58.479509,-34.620611],[-58.480877,-34.622016],[-58.483433,-34.624071],[-58.484799,-34.624621],[-58.486005,-34.625078],[-58.487335,-34.625536],[-58.487961,-34.625774],[-58.48856,-34.625975],[-58.4912,-34.626929],[-58.494921,-34.629453],[-58.495758,-34.630031],[-58.496286,-34.630383],[-58.499362,-34.63142],[-58.501098,-34.632118],[-58.50246,-34.632728],[-58.505033,-34.633819],[-58.505595,-34.634026],[-58.508461,-34.634553],[-58.509721,-34.634632],[-58.51012,-34.634671],[-58.510519,-34.634655],[-58.510904,-34.63459],[-58.5114,-34.634398],[-58.512507,-34.633899],[-58.513791,-34.633382],[-58.514162,-34.633282],[-58.515253,-34.633058],[-58.515885,-34.633012],[-58.516843,-34.633035],[-58.517148,-34.633089],[-58.517758,-34.633094],[-58.518132,-34.633048],[-58.518431,-34.633054],[-58.518828,-34.633074],[-58.519528,-34.633221],[-58.519731,-34.633227],[-58.519869,-34.633198],[-58.520064,-34.633182],[-58.520279,-34.63319],[-58.520442,-34.633252],[-58.520603,-34.633337],[-58.520751,-34.633462],[-58.52099,-34.633602],[-58.521626,-34.633785],[-58.521743,-34.633848],[-58.52384,-34.634375],[-58.524186,-34.634461],[-58.524155,-34.634629],[-58.524081,-34.635738],[-58.524051,-34.636027],[-58.524126,-34.636103],[-58.524193,-34.636136],[-58.524243,-34.636142],[-58.524299,-34.636128],[-58.525441,-34.63559],[-58.526145,-34.635398],[-58.526824,-34.635123],[-58.527523,-34.634906],[-58.528809,-34.634677],[-58.529307,-34.63461],[-58.529878,-34.634565],[-58.531134,-34.634515],[-58.532739,-34.634478],[-58.533748,-34.634513],[-58.534453,-34.634563],[-58.535256,-34.634642],[-58.535771,-34.634666],[-58.536164,-34.634662],[-58.536512,-34.634636],[-58.537128,-34.634537],[-58.537854,-34.634337],[-58.538504,-34.634117],[-58.547851,-34.630799],[-58.54927,-34.630329],[-58.550021,-34.630118],[-58.550985,-34.629908],[-58.55165,-34.629788],[-58.552778,-34.629634],[-58.553579,-34.629545],[-58.554271,-34.629516],[-58.555293,-34.629503],[-58.556247,-34.62953],[-58.557138,-34.629593],[-58.570019,-34.631012],[-58.571316,-34.631125],[-58.572527,-34.631166],[-58.581235,-34.631029],[-58.58253,-34.63105],[-58.583525,-34.631126],[-58.584469,-34.631253],[-58.587367,-34.631768],[-58.588312,-34.631912],[-58.589065,-34.631988],[-58.589864,-34.632027],[-58.604929,-34.632307],[-58.607538,-34.632357],[-58.608434,-34.632283],[-58.609344,-34.632273],[-58.610769,-34.63222],[-58.610919,-34.632182],[-58.611067,-34.632116],[-58.611658,-34.63181],[-58.611808,-34.632094],[-58.612309,-34.633455],[-58.612423,-34.633691],[-58.612734,-34.634114],[-58.613088,-34.634444],[-58.614157,-34.635297],[-58.615726,-34.636635],[-58.61754,-34.6381],[-58.618572,-34.638956],[-58.619042,-34.639367],[-58.619563,-34.639777],[-58.620575,-34.640631],[-58.620671,-34.640682],[-58.622319,-34.642323],[-58.62245,-34.642505],[-58.622525,-34.642615],[-58.622614,-34.647325],[-58.622622,-34.648163],[-58.622629,-34.649197],[-58.622678,-34.65085],[-58.622818,-34.659369],[-58.622835,-34.660429],[-58.624361,-34.660418],[-58.625437,-34.660437],[-58.625272,-34.66054],[-58.6253,-34.661902],[-58.625343,-34.662134],[-58.627241,-34.665734],[-58.627837,-34.666896],[-58.628567,-34.668378],[-58.628687,-34.66864],[-58.630479,-34.672498],[-58.6311,-34.673776],[-58.632877,-34.677597],[-58.635866,-34.683946],[-58.635926,-34.684148],[-58.636157,-34.685379],[-58.636677,-34.688308],[-58.636867,-34.689264],[-58.637171,-34.691651],[-58.637328,-34.692049],[-58.637579,-34.692556],[-58.637669,-34.692706],[-58.637709,-34.692772],[-58.638341,-34.693558],[-58.638923,-34.694],[-58.639497,-34.69447],[-58.640381,-34.695157],[-58.640837,-34.695395],[-58.641267,-34.695593],[-58.641847,-34.695804],[-58.642386,-34.695938],[-58.64338,-34.696112],[-58.644982,-34.696337],[-58.647834,-34.696765],[-58.648498,-34.696901],[-58.648575,-34.69692],[-58.649209,-34.697097],[-58.649899,-34.697361],[-58.651704,-34.697979],[-58.654527,-34.698994],[-58.655596,-34.699403],[-58.656819,-34.699835],[-58.65758,-34.700129],[-58.658352,-34.700406],[-58.659893,-34.700941],[-58.663296,-34.702154],[-58.664239,-34.702465],[-58.664962,-34.7028],[-58.665705,-34.703066],[-58.668602,-34.704221],[-58.669454,-34.70458],[-58.669643,-34.70464],[-58.672398,-34.705742],[-58.675271,-34.706815],[-58.676304,-34.707228],[-58.677397,-34.707643],[-58.677353,-34.707819],[-58.675276,-34.709342]],
   "type":"LineString"}}],
"info":{"took":3,"copyrights":["GraphHopper","OpenStreetMap contributors"]}}

FFWDME.JS

Hello ,

what is the best way to use GraphHopper with FFWDME.JS ?

Geocoding API in local installations ?

Hi and thanks for this great piece of software.

I have installed graphhopper successfully on my EC2 instance and it works perfectly as for the routing api.

I wonder if the geocoding API is excluded from the local installation or has to be enabled somehow, becaue it seems to be not reachable under hostname:port/geocode or hostname:port/api/1/geocode , as documented in your docs...

Getting started with the Java client

Question:
I am really confused in using Route Optimization API. I just cloned the directions-api-vrp-java-client. Now i want to test the example given. So what should i do after cloning the API from the repository. Could you guys be able to provide a documentation for this as well. I am just a beginner in android programming.

Answer:
After you cloned the repository execute the steps described under 'Maven' to build the client jar locally and include the maven xml snippet in your project. Then use one of the examples to use the API for your needs.

Matrix API bug for disconnected locations

curl "https://graphhopper.com/api/1/matrix?point=55.925644%2C-5.152433&point=55.918959%2C-5.159128&type=json&vehicle=small_truck&debug=true&out_array=weights&out_array=times&out_array=distances&key=[key]"

This returns time and distance == 0 but should either throw a RuntimeException (would be consistent with the Routing API) or an 'infinite' value to still use parts of the results.

Although we normally prefer fail fast, I would prefer an 'infinite' value here. Some other Matrix API providers return negative values which I don't like too.

Include live docs

ReDoc is really useful for displaying an explorable API with swagger spec. See e.g. here

We should set this up on our servers.

Re-route calculation possible?

Does the GraphHopper Directions API has the ability to "re-route" the user if they deviate from the directions? i.e. will it automatically update the set of directions or is there some function to determine if the user is still on/off track?

There is no such functionality offered directly via the Routing API, but you should be able to do this easily on the client side via calculating the distance to the route and fetch a new route depending on your requirements. E.g. for Java you could use this snippet to calculate the distance, and then do this for the first 100 points or only for points of the turn instructions.

Slow response for none-EU located servers (Australia, USA, Japan, Africa, ...)

The handshake for SSL is expensive as many times it needs to send forth and back something. So the solution is to keep this handshake at the initial request only (our server should support this via keepalive) and follow up requests are much faster, which you can try e.g. via:

URL="https://graphhopper.com/api/1/route?key=[YOUR_KEY]&point=-34.0102021%2C151.1270069&point=-33.95237450124232%2C150.9959234857656&vehicle=car&locale=en"
curl -w "tcp: %{time_connect} ssl:%{time_appconnect} all: %{time_total}\n" -sk -o /dev/null $URL -o /dev/null $URL -o /dev/null $URL

Another solution will be established in the future to have several servers across the world. Initial connections can be tested from various locations with this service

Our Java and JavaScript clients already do this 'keepalive' for you as JavaScript uses the default for HTTP1.1 and Java uses okhttp having similar defaults.

Using Python

How to use the GraphHopper Directions API with Python?

This project shows some basics. We'll improve and create a python notebook from it or maybe even something which runs in jupyter

The currently untested python client for the GraphHopper route optimization API is located here

Remaining credits for 'CORS' requests not accessible

After email exchange with Peter K, it seems like using the response header of every response (not only the errors, see https://graphhopper.com/api/1/docs/#http-error-codes) to determine the remaining credits is currently not working as the headers are not properly set.

Example:

The request:
https://graphhopper.com/api/1/route?point=46.43762,6.90974&point=46.44818785131702,6.873624015034138&instructions=false&type=json&key=[some_key]&vehicle=foot&elevation=true

The response's headers
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 23 Dec 2015 09:24:13 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 714
Connection: keep-alive
Access-Control-Allow-Origin: *
X-RateLimit-Limit: 500
X-RateLimit-Remaining: 480
X-RateLimit-Reset: 17008
X-RateLimit-Credits: 1
Strict-Transport-Security: max-age=31536000; includeSubDomains;

By looking at Firebug's logs, it seems that the Access-Control-Expose-Headers key is not set in the response header (whereas the Access-Control-Allow-Origin is indeed set to 'widlcard').

What is the response for the Matrix API if a location cannot be found?

See these coordinates:

https://graphhopper.com/api/1/matrix?point=53.600859,8.304977&point=53.639753,8.246269&type=json&vehicle=car&debug=true&key=[YOUR_KEY]&out_array=times&out_array=distances

Of course, you have to replace YOUR_KEY

The response in this example is:

{"message":"Bad Request",
 "hints":[{"details":"java.lang.IllegalArgumentException","message":"Cannot find from_points: 1"},
          {"details":"java.lang.IllegalArgumentException","message":"Cannot find to_points: 1"}]}

Here is the GraphHopper Maps query with the same coordinates.

objectives

Thanks for this :) !

Two minor documentation mistakes:

i.e. minimize the overall makespan then change the algorithm object to:

Algorithm Example -> Objectives Example?

PHP client

We got a request asking for how to do an API request via PHP. The most important part is to use the correct URL:

<?
$adr='https://graphhopper.com/api/1/geocode?q=' . urlencode('Deutschland Berlin') . '&locale=de&key=[YOUR_KEY]';
$str=file_get_contents($adr);
echo $str;
?>

Or for the routing API:

<?
$adr='https://graphhopper.com/api/1/route?point=' . lat1 . ',' . lon1 . '&point=' . lat2 . ',' . lon2 . '&locale=de&vehicle=car&key=[YOUR_KEY]';
$str=file_get_contents($adr);
echo $str;
?>

Then use the $str for further JSON parsing or use httpful a HTTP client making such requests easy for PHP.

Our route optimization API contains a swagger specification from which you can easily create an already working PHP client. Contact us if you do not know how to handle that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.