Topic: Google Maps Distance Matrix API
Hello! Do you plan to enter this feature? If yes, when?
I need ETA
https://developers.google.com/maps/docu … tart?hl=ru
Offtop: do you speak rus?
You are not logged in. Please login or register.
Infinity Code Forum → Feature Requests → Google Maps Distance Matrix API
Hello! Do you plan to enter this feature? If yes, when?
I need ETA
https://developers.google.com/maps/docu … tart?hl=ru
Offtop: do you speak rus?
Hello.
We did not plan to add support for this API, because it can be implemented using Google Directions API.
If you really need this API, we can add classes to work with it.
But I do not see any advantages over Directions API.
Yes I speak Russian.
If you want, you can write in support in Russian (support@infinity-code.com).
For forum posts, please use English.
Hello! Could you explain me how to get estimated time of arrival and distance? please give me example of code
Thx
Example:
using System.Linq;
using UnityEngine;
public class DistanceAndDuration:MonoBehaviour
{
private void Start()
{
OnlineMapsGoogleDirections.Find("Los Angeles", new Vector2(-118.178960f, 35.063995f)).OnComplete += OnGoogleDirectionsComplete;
}
private void OnGoogleDirectionsComplete(string response)
{
Debug.Log(response);
OnlineMapsGoogleDirectionsResult result = OnlineMapsGoogleDirections.GetResult(response);
if (result == null || result.routes.Length == 0) return;
OnlineMapsGoogleDirectionsResult.Route route = result.routes[0];
OnlineMaps.instance.AddDrawingElement(new OnlineMapsDrawingLine(route.overview_polyline, Color.red, 3));
int distance = route.legs.Sum(l => l.distance.value);
int duration = route.legs.Sum(l => l.duration.value);
Debug.Log("Distance: " + distance + " meters, or " + (distance / 1000f).ToString("F2") + " km");
Debug.Log("Duration: " + duration + " sec, or " + (duration / 60f).ToString("F1") + " min, or " + (duration / 3600f).ToString("F1") + " hours");
}
}
Thank YOU!
Infinity Code Forum → Feature Requests → Google Maps Distance Matrix API
Powered by PunBB, supported by Informer Technologies, Inc.