Alternatives to Googles Distance Matrix service?

后端 未结 4 530
轮回少年
轮回少年 2021-02-02 00:22

I am working on a quote calculator that will generate a quote based on mileage between various locations (amongst other conditionals). Up until two days ago, I had planned to us

相关标签:
4条回答
  • 2021-02-02 01:12

    Unfortunately for the Distance Matrix API, Google strictly says you NEED to display the map in your application:

    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. http://developers.google.com/maps/documentation/distancematrix/#Limits

    However, what I think is more useful for your need is Google Directions API. The directions API allows you to cover your requirements.

    The total distance is returned in the JSON object from the request.

    You can select upto as many different locations to find distances between using the Waypoints in your search request. The distances between these locations are then returned in each "leg".

    You can obtain the average distance from multiple different routes to your destination by specifying the alternatives parameter in your search request to true. See: http://developers.google.com/maps/documentation/directions/#RequestParameters

    Best of all, there is no requirement from Google to display the Google Map in your application when using this service.

    I should also mention the drawbacks to this service, if you choose to use it.

    1. The request time it takes to process your request will be slightly longer than if you were to use the Distance Matrix API.
    2. You'll have a lot of unneeded data in the return object, for instance the individual "steps" of the route in the returned json object is not necessary based on your application requirements.

    Given the drawbacks, I'd still highly recommend looking into the Directions API for your application.

    0 讨论(0)
  • 2021-02-02 01:15

    I don't know if Google Static Maps count as a map, but it should, since it's a Map and from Google. You could calculate the route and then show it as an image from Static Maps. No extra map loading times required. Only one image.

    https://developers.google.com/maps/documentation/staticmaps/#Paths

    0 讨论(0)
  • 2021-02-02 01:15

    Streetmap and arcserver can solve a vehicle routing problem but it's not free. Read more here: http://www.esri.com/data/streetmap.

    0 讨论(0)
  • 2021-02-02 01:21

    Many developers have been able to do this with the Bing Maps REST routing service http://msdn.microsoft.com/en-us/library/ff701705.aspx. It requires a bit more development but works well. Here is an example: http://code.msdn.microsoft.com/Bing-Maps-trip-optimizer-c4e037f7

    0 讨论(0)
提交回复
热议问题