Maps direction Quota limits

戏子无情 提交于 2019-12-24 08:42:43

问题


Hi i have written a google script that takes out the distance for the specific start point and endpoint. I have read a lot of articles online but they don't include the limits for google map script.

I want to know for how many number of start points and end points (how many calls) will i be able to take out using a normal gmail and a business gmail id.


EDIT:

I'm using Maps.newDirectionFinder().getDirections();


回答1:


https://developers.google.com/maps/documentation/directions/#Limits

Usage Limits

The Directions API has the following limits in place:

  • 2,500 directions requests per 24 hour period. When the mode of transportation is driving, walking, or cycling, each directions search counts as a single request.
  • Searching for transit directions counts as 4 requests.
  • Individual requests for driving, walking, or cycling directions may contain up to 8 intermediate waypoints in the request. Waypoints can not be specified for transit requests.

Google Maps API for Business customers have higher limits:

  • 100,000 directions requests per 24 hour period.
  • 23 waypoints allowed in each request. Waypoints are not available for transit directions.
  • Directions API URLs are restricted to 2048 characters, after URL Encoding. As some Directions API URLs may involve many locations along a path, be aware of this limit when constructing your URLs.

The Directions API may only be used in conjunction with displaying results on a Google map; using Directions data without displaying a map for which directions data was requested is prohibited. Additionally, calculation of directions generates copyrights and warnings which must be displayed to the user in some fashion. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.




回答2:


From https://developers.google.com/maps/documentation/distancematrix/#Limits:

Each query sent to the Distance Matrix API is limited by the number of allowed elements, where the number of origins times the number of destinations defines the number of elements.

The Distance Matrix API has the following limits in place:

  • 100 elements per query.
  • 100 elements per 10 seconds.
  • 2,500 elements per 24 hour period.

You can pack as many origin/destination pairs as will fit into a URI of about 2000 characters or less:

Distance Matrix API URLs are restricted to approximately 2000 characters, after URL encoding. As some Distance Matrix API service URLs may involve many locations, be aware of this limit when constructing your URLs. Note that different browsers, proxies, and servers may have different URL character limits as well.

Also, take note that the terms require you use the API for apps using Google Maps in some way:

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.




回答3:


I know it's pretty offtopic but please read as it can solve the quota limit...

If you want you can calculate the distance using only code instead of using Google Maps API.

I have written it in PHP but it is portable to any language.

Make a AJAX request containing the two coordinates of your cities that the API found.

In the PHP you can calculate the distance between two points without having to use the Javascript map api.

If you can have the coordinates without using the API you could calculate directly in PHP...

Javascript:

$.get( php_script , function( data ) {
   alert( "The distance is "+data+" km" );
});

PHP:

unset($params);
$params["point1"]["lat"]; 
$params["point1"]["lng"]; 
$params["point2"]["lat"]; 
$params["point2"]["lng"]; 
echo orthodromy($params);

function orthodromy($params) {
   unset($lat1, $lng1, $lat2, $lng2);
   $lat1 = $params["point1"]["lat"]; 
   $lng1 = $params["point1"]["lng"]; 
   $lat2 = $params["point2"]["lat"]; 
   $lng2 = $params["point2"]["lng"]; 

   if (!is_numeric($lat1) || !is_numeric($lng1) || !is_numeric($lat2) 
       || !is_numeric($lng2)) return false;

   unset($dist);
   $dist = acos(
      sin( deg2rad($lat1) ) *
      sin( deg2rad($lat2) ) +
      cos( deg2rad($lat1) ) *
      cos( deg2rad($lat2) ) *
      cos( deg2rad($lng1-$lng2) )
   ) * 6371;
   if (!is_numeric($dist)) return false; else return $dist;
}


来源:https://stackoverflow.com/questions/21418298/maps-direction-quota-limits

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!