graphhopper / directions-api

Issues for the GraphHopper Directions API
https://graphhopper.com/api/1/docs/
60 stars 25 forks source link

Maximum locations per request in "info" endpoint #42

Open fbonzon opened 7 years ago

fbonzon commented 7 years ago

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.