Questions tagged [google-distancematrix-api]

The Google Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations

The Google Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations. The information returned is based on the recommended route between start and end points, as calculated by the Google Maps API, and consists of rows containing duration and distance values for each pair.

This service does not return detailed route information. Route information can be obtained by passing the desired single origin and destination to the Directions API.

Official Documentation

395 questions
2
votes
1 answer

How do I use Distance Matrix API in ReactJS using @react-google-maps/api?

I am using the above package and I can't find proper documentation to implement the code. Currently, this is my code: import React, { Component } from "react"; import { GoogleMap, DistanceMatrixService } from "@react-google-maps/api"; class…
user13126527
2
votes
1 answer

Distance matrix api for Google

I am using Google Distance Matrix API. But I am unable to figure out the API cost, it has written on their website that "price per element". So, if I have two origins and 1000 destinations, then what will be my total API cost, and is the example…
2
votes
1 answer

Distance Matrix API AsyncTask Java

I have been trying to get the walking duration and distance between two locations using Distance Matrix API. I want to store this results (Distance and Duration) in variables that I will be able to access from other classes/activities. I managed to…
2
votes
1 answer

Passing multiple destinations as array to distance matrix api

I am calling distance-matrix api with multiple destinations as array but I am getting only one Array as response destinationrequestsample---> ["0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0",…
Ankit Kumar
  • 118
  • 12
2
votes
1 answer

How are multiple origins/destinations supposed to be used in google distance matrix?

I'm wondering about origins and destinations in distance matrix being plural. According to the documentation you can use several locations as a starting and/or finishing point. How can several locations be one point? Looking at other posts it seems…
Robin Manoli
  • 2,162
  • 2
  • 25
  • 30
2
votes
0 answers

How to save distance results for Distance Matrix API in PHP to calculate fare with formula

I created a form using PHP to add booking and to calculate fare before adding the booking. I am using Google Places API for Auto-fill Addresses. When User Click on Calculate Fare Button it shows the Distance in Miles, Kilometers, Total Time, In…
Hasnnnaiin
  • 73
  • 7
2
votes
0 answers

How to display google distance matrix API response in grid cell per row?

I want to display a grid with start and destination travel point with google distance matrix response value of the same. For this, I have GPS coordinates of origin and destination in the array. I am able to build the grid, and I am unable to fill…
2
votes
1 answer

getDistanceMatrix service in google map returns status "OVER_QUERY_LIMIT" for some set of coordinates

I'm using a single origin. When I check with sample latitude longitude values in the example given in the google maps documentation it's working. But If I change the coordinates it's not working returning "OVER_QUERY_LIMIT". The Below code is…
2
votes
0 answers

Fetching the nearest location of points, while accounting for bodies of water

I've got a database of points (in this case, schools) and in my app, users search for the nearest ones to them. Under the hood, we're currently using ElasticSearch to filter by latlng (using Geo Distance, which gets the distance as the crow flies.…
Pezholio
  • 2,439
  • 5
  • 27
  • 41
2
votes
1 answer

How to pass future time using "departure_time" as parameter into HTTP request via distance matrix api

I am using distant matrix api to get the travel time between 2 points and I want to consider the traffics when calculating the travel time, I am calling the distance matrix while passing this URL as part of the request…
Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53
2
votes
0 answers

Having an issue getting a value returned from inside a nested function in React. Might be scope, but maybe async issue

I'm connecting a custom location api to google maps. On each locations longLat property I am calling a function calculateDistances to get the arguments needed for a Google Distance Matrix API call. Here is where that call is…
2
votes
0 answers

why the distance varies for Google Distance Matrix Api?

We are planning to use Distance matrix API to calculate the shortest distance from a pickup to deliver point and we will charge prices based on the distance. We have noticed the distance returned by google matrix API varies, even though we are not…
2
votes
2 answers

How to use google Distance matrix API in Angular

I am trying to use the google Distance Matrix API. https://developers.google.com/maps/documentation/distance-matrix/start . I have the necessary request parameters that are got from current location(origin lat&lng) and when i click on marker( I get…
Nancy
  • 911
  • 7
  • 26
  • 54
2
votes
1 answer

how to input client ID or API key in distance Matrix Google API Service

I am trying to get shortest distance between two locations using google Distance Matrix API. To get shortest distance I am passing OPTIMISTIC parameter to trafficModel. To make it work I have to pass client ID or API key. I have both. I don't know…
2
votes
3 answers

Calculate the duration or expected drive time between two latitude, longitude points

I want to calculate the duration between two points. I know there is Google Maps API but I don't want to use it, I need an equation to do it. There is one calculate the distance I need one for the duration of drive time.
1 2
3
26 27