Coder Social home page Coder Social logo

directions-api's Introduction

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

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.

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').

FFWDME.JS

Hello ,

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

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.

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

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"]}}

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.

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

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.

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.

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.

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...

objectives

Thanks for this :) !

Two minor documentation mistakes:

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

Algorithm Example -> Objectives Example?

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 :)

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.

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

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.

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.

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.

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.

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.