简体   繁体   中英

Google Distance Matrix Usage explanation

Google Distance Matrix say:

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

Google Maps API for Business customers have higher limits:

625 elements per query. 1 000 elements per 10 seconds. 100 000 elements per 24 hour period. Maps API for Business customers can purchase additional quota by contacting their Google Enterprise Sales Account Manager.

What is the definition of an element? What is meant by 100 elements per query and 100 elements per 10 seconds?

Can I show driving distances on an html table with a link to google maps? ie On a web page, I will have one column for the inspector name, one column for the distance in KM and one column for map icon which will navigate the user to google maps.

At one time, the user can display 200 inspectors on the web page after quering the database and at one time there might be over 100 users using this page.

Are there any restrictions on using JSON for distance matrix without API Key?

What is the defination of elements?

An element is a distance calculation. That is why "the number of origins times the number of destinations defines the number of elements.". If you request the distance from point A to B, you're making a 1x1 request, totaling 1 element. If you were to request distance from A to B, C and D, that would be 1x3 = 3 elements.

What is meant by 100 elements per query and 100 elements per 10 seconds?

You can make a 10x10 elements or ten 1x10 elements query every 10 seconds.

Can i show driving distance on html table with link to google map? ie On web page, i will have one columns for inspector name and one column for distance in KM and one column for map icon which will nevigate user to google map after they click on it.

Well, yes, that's doable, but I think it's outside the scope of this particular thread. It has little to nothing to do with google maps api: you have to parse the response and render the table yourself.

In Distance Matrix 100 000 elements per 24 hour period, a maximum of 625 elements per query and a maximum of 1 000 elements per 10 seconds.

As per this one there is option to get purchase these API but basic question is remain same for us if we are requesting single origin and multiple destination then how element calculation done by google?

But in document google says :

Elements

The information about each origin-destination pairing is returned in an element entry. An element contains the following fields:

status: See Status Codes for a list of possible status codes. duration: The duration of this route, expressed in seconds (the value field) and as text. The textual representation is localized according to the query's language parameter. distance: The total distance of this route, expressed in meters (value) and as text. The textual value uses the unit system specified with the unit parameter of the original request, or the origin's region.

What is the definition of an element?
The information about each origin-destination pairing is returned in an element entry. An element contains the following fields:

  • status
  • duration
  • duration_in_traffic
  • distance

In actual call the elements will look like

<row>
   <element>
     <status>OK</status>
     <duration>
        <value>1550</value>
        <text>26 mins</text>
     </duration>
     <distance>
        <value>16748</value>
        <text>16.7 km</text>
     </distance>
     <duration_in_traffic>
        <value>1946</value>
        <text>32 mins</text>
     </duration_in_traffic>
   </element>
</row>

Each query sent to the Distance Matrix API generates elements, where the number of origins times the number of destinations equals the number of elements.

What is meant by 100 elements per query and 100 elements per 10 seconds?
As said above, the query generates the elements based on the number of origins and number of destinations sent to the query.
So maximum you can sent one query with 10 origins and 10 destinations per 10 seconds. Because this query returns 100 elements.
OR
you can sent 10 query with 1 origin and 10 destinations(vice versa) per seconds. Because each query returns 10 elements. So total we have 100 elements.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM