What is the maximum number of waypoints you can have with the Routing API?
I am looking to have a starting location and then add up to 500 waypoints and have it optimize the route.
Is this possible with the Routing API?
We only support GET method, POST will allow more, but it is not (yet ) supported currently support whatever URL length limits allow.. So something like 100+ waypoints ,But for optimising the route, there is a separate service which solves this.
Related
We are going to use HERE Routing API to calculate a route in bus mode with route shape. Our use case: we know coordinates of bus stops but we need route shape between them. Bus mode take into account taxi/bus restricted streets as well as streets reserved for exclusive taxi/bus access and this is exactly what we need. But also we need take into account traffic data (live or typical) for this route, for specified departureTime. Can we get this info by HERE Routing API? For example, as durationInTraffic of route like google does? If no, is there any other HERE api to get such info? We saw HERE Traffic API but it looks like it provide full info about some area to draw it on map, not for route.
Yes, it takes if you pass departure time as request param, see https://developer.here.com/documentation/routing-api/8.20.0/dev_guide/topics/use-cases/departure-time.html
I need to implement a toll for calculating the route, and I wanted to use Toll Extension like described here. But I can't find documentation for this API. Any information about it redirects to Fleet Telematics API.
I would like to avoid having to implement the whole Fleet Telematics API or guessing what are the Toll Cost Extension's API parameters from the example in the first link.
I am looking for an answer that will point me to official docs or any official info saying this is deprecated and should not be used anymore.
Could you please check this toll cost API documentation if this accomplish your task.
https://tce.api.here.com/2/calculateroute.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&waypoint0=49.33729606975952,0.5986232869327068
&waypoint1=49.493527937780975,0.10129541603788539
&mode=fastest;car
&cost_optimize=1
Link to the docs is here.
Would like to highlight one problem - if you choose to just calculate toll based on existing route you may face the issue with too long url on their NGINX side. Also this API (TCE) seems to be deprecated, so it may be inevitable (unfortunately) to use fleet API.
In fleet API most params are the same like in TCE/Route API, some result are hidden via attributes. More on https://developer.here.com/documentation/fleet-telematics/api-reference.html. Worth to mention is that at least for now is it very expressive and there is a limited option to change this. For example, my TCE toll response has about 10k lines of formated json... whereas the same for fleet has 300k because there is no option (with routeMatch=1 to remove links/waypoints.
From my already quite long experience with Here API as a whole, it requries some time to go deep into it... and find things.
I was trying to use Google Distance Matrix API JSON in my project, after formatting the url, for example:
http://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&mode=bicycling&language=en&sensor=false
I was able to view the result in browser, but when I tried to make a http request to get the result, I will receive status : REQUEST_DENIED
In documentation:
REQUEST_DENIED indicates that the service denied use of the Distance
Matrix service by your application.
But I still don't know why my request is denied. More Info from google:
Use of the Distance Matrix API must relate to the display of
information on a Google Map; for example, to determine
origin-destination pairs that fall within a specific driving time from
one another, before requesting and displaying those destinations on a
map. Use of the service in an application that doesn't display a
Google map is prohibited.
If I can't get the result, how can I apply it on google map?
Anyone with same problem? I will post sample code later, to clarify my question more clearly.
I had a similar problem, but it was due to assuming that the sensor tag would default to false, but it is in fact required.
Google Distance Matrix API has a limit of elements set to 2500.
I highly doubt it that you would have gone over this limit, as you would have to have calculated the maximum 10 x 10 matrix 25 times over.
I am from South Africa, and it refused to work for any local addresses until I changed the transport mode to driving (from walking, I mean seriously, we have cars). Maybe that'll help
https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=San+Francisco&key=YOUR_API_KEY
Please make sure that you have created a credentials on Google Console which can be called as "API KEY" and you are using this API KEY in above request URL on the place of "YOUR_API_KEY"
I had the same problem earlier.
you need to check out with the Google Api key version and codes/scripts of version you are using.
I believe you need to get a Google Maps API key
You need to set an API KEY for using Google map services like this:
https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=Washington,DC&destinations=New+York+City,NY&key=**YOUR_API_KEY**
First thing is that you need is to have an API key assigned to your application. This is done by creating it in the Google API Manager.
I hope your have enabled distance matrix API from google console for your application.
please refer
https://support.google.com/googleapi/answer/6158841?hl=en
along with this you can restrict API_KEY for unauthorized use.
So I have an application I am working on at work that we have a few hundred clients running on. We are working on a brand spanking new ASP.NET MVC 3 app for it, and I am working on the routes for this app.
I posted recently on a solution I came up with for dynamic routes, and it works fine on a few entries I have in a Sql Express DB. Essentiall it creates routes for every entry that I have in this DB.
So, my question is...If I were to implement this on an enterprise application, would the creation of several hundred if not thousands of routes added into my application have any negative consequences?
Concerning the dynamic route table, there is a recommendation which you seem to follow already:
Use named routes. Named routes are an
optional feature of routing. The names
only apply to URL generation - they
are never used for matching incoming
URLs. When you specify a name when
generating a URL we will only try to
match that one route. This means that
even if the named route you specified
is the 100th route in the route table
we'll jump straight to it and try to
match.
Besides the number of customers / routes, you should also consider the estimated number of requests per day (for which you should be worried more, IMHO), and take into account the scalability of your web server (worker threads, hardware, ...) in consequence.
If you clients use own domains with you application, use custom IRouteConstraint in routes to check request domain and filter only this routes. Tt's solution also protect routing from collisions.
So best way for you to both task - routing request and building links - use cached routing.
You can inherits and extend default MVC Route class
To speedup link building: Override GetVirtualPath that calculate hash from RouteData values and using it to put and get url values to and from cache.
To speedup routing: override GetRouteData also to use cashed RouteDate with url hash.
This solution may be requred more memory, but in most cases you have limited set of url on pages.
You question is slightly unclear. By "dynamic route" do you mean you go to the DB tier on a request to resolve the route or do you query against your db to create the source file for the route table?
In the first case performance should be constant. (The overhead of checking the DB against the number of users you have will not change.) So you should see performance effects right away.
In the second case I expect the routing code will be slower if it has that many items to check -- but it is easy to test.
There is defiantly a performance hit once you start to get over a certain threshold of routes. I don't have any hard benchmarks on this but I have redesigned a few poorly performing sites now.
The more you can use the same route for many different url's with parameters the better.
Just from observation it seems when you start to get close to 1k routes is when it starts really bottoming out.
I am working on a project which requires a server side access to google map api. i want to calculate distance (actual distance, not straight line). google map api supports javascript and not asp.net. please give suggestions ...!
you specified google maps in your question - but have you looked at Virtual Earth? Specifically this routing with Virtual Earth Web Service example sounds exactly like what you want:
server-side access (just Add Service Reference inside visual studio)
actual distance (not straight line) since it is using a route
The concerns raised by others about T&Cs for 'internal/intranet use' apply to VE as well as Google I think - you'll have to read up about whether your application needs licensing or not.
p.s. if you did just want to calculate straight-line distance, I have instructions using SQL Server 2008; which also links to some straight c# code that does it too.
The Google API allows you to Geocode via a server side call:
http://code.google.com/apis/maps/documentation/services.html#Geocoding_Direct
This would allow you to get the longitude and latitude of the locations. You can then cache these and use them to calculate distance using the techniques CMS suggests.
You will need to be careful of the Google T&C's though as you are only allowed to store the geocoding data for use on a Google map which is publicly available.
You would probably also run into limitations on the number of requests you could make from a single IP.
However I think what you mean by non-straight line distance is distance taking into account roads and one way streets etc.
If this is the case I think a commercial service is your only option. Although theoretically you could do it all via screen scraping, I'm almost certain that this would break Google's T&C's.
The simplest solution would probably be just to embed a Google map on a page of your application and let the user calculate the distance. You could pre-fill the to and from fields if required.
Again if this is for an internal app i.e. Not publicly available "my understanding" of the Google T&C's would forbid this.
Use something like firebug or fiddler to look at the requests that are being sent to Google from javascript you should then beable to build the request using that information and an HTTPWebRequest in .net and retrieve the same information.
HTH
You can calculate the distance of two geographical coordinates (latitude, longitude) using the Great-circle distance algorithm.
Here you can find some other formulas for distance calculation.
Well, you've pretty much identified the key issue, the Gmaps API is a browser resident javascript API and there's not much getting around that. Most of the API is executed in the browser so there's not much network traffic to spy on.
As tsaunders mentions there is a geocoding API call that is restfully accessible, but it only does reverse/geocoding and if you have lat/lng's already you can use the calculations the rms suggested, but they are as tsaunders points out 'as the crow flies' distance.
If indeed you are looking for road taken distance, the API does do routing but you are back in the browser to get the start/end points from the user.
Perhaps you can be a little more specific about what you are trying to do and why you feel this requires you to to access the API from your server. My application for instance has features that gather information from the user and sends requests back to my server to work on, some of that data are processed by the Gmaps API first.
If I were to use a API platform, I certinaly would not use Google as the free one does not include advances Geocoding menaing the accuracy is poor. There is also no sla , support or rights of service.
The directions are poor, the coverage for Ireland and Geocoding is almost childlike and the privacy stinks. No professional business would use a google mapping solution.
They copy everyone else's idea, say they are there own and get loads of press (they only added tube stations in 2006) an dcyclc lanes (2010), viamichelin added these 2006 and Traffic in 2009 !
Any agency or developers looking for an API should stick to Bing or ViaMichelin for better customisation and user experience which is killer !