public void FindDirection()
{
//OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections
// (
// googleAPIKey,
// "Los Angeles", // FROM (string or Vector2)
// new Vector2(-118.178960f, 35.063995f) // TO (string or Vector2)
// );
OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections(googleAPIKey, origin, destination);
request.OnComplete += OnFindDirectionComplete;
request.Send();
}
private void OnFindDirectionComplete(string response)
{
OnlineMapsGoogleDirectionsResult result = OnlineMapsGoogleDirections.GetResult(response);
if (result == null || result.routes.Length == 0)
{
Debug.Log("Find direction failed");
Debug.Log(response);
return;
}
foreach (OnlineMapsGoogleDirectionsResult.Leg leg in result.routes[0].legs)
{
foreach (OnlineMapsGoogleDirectionsResult.Step step in leg.steps)
{
Debug.Log(step.string_instructions);
}
}
OnlineMapsDrawingLine route = new OnlineMapsDrawingLine(result.routes[0].overview_polylineD, Color.green);
OnlineMaps.drawingElementManager.Add(route);
}
Coordinates
Origin - 51.3260028,-0.7753541
Destination - 51.3363296,-0.775708