Topic: Find distance , direction b/w two places
how to find distance b/w two points .,???
just like google maps??? like this image ..?
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Find distance , direction b/w two places
how to find distance b/w two points .,???
just like google maps??? like this image ..?
Hello.
OnlineMapsUtils.DistanceBetweenPoints
http://infinity-code.com/doxygen/online … bc84a165f2
OnlineMapsFindDirection.Find
http://infinity-code.com/doxygen/online … ce4514aa98
FindDirection Example:
http://infinity-code.com/atlas/online-m … ample.html
correct me if i m wrong .
this is displacement b/w two points
float DisplacementKM = OnlineMapsUtils.DistanceBetweenPoints(point1 ,point2);
....
if i m right , then there should be a function to calculate distance amoung points
Almost:
float DistanceKM = OnlineMapsUtils.DistanceBetweenPoints(point1, point2).magnitude;Unfortunately, the current version does not have a method that calculates the distance for array of points.
You can calculate the distance between each pair of points (1-2, 2-3, 3-4, ...) and sum the results.
Or we can add this method.
when set two distant points for directions , it start showing errors..
this is my code
public void findDirection()
{
OnlineMapsFindDirection.Find(from.text, to.text, true).OnComplete += onFindLoaction;
//OnlineMapsFindDirection.Find();
Debug.Log("send request");
}
private void onFindLoaction(string routXml)
{
Debug.Log("complete");
List<OnlineMapsDirectionStep> steps = OnlineMapsDirectionStep.TryParse(routXml);
if (steps != null)
{
foreach (OnlineMapsDirectionStep step in steps) Debug.Log(step.stringInstructions);
List<Vector2> points = OnlineMapsDirectionStep.GetPoints(steps);
OnlineMapsDrawingLine route = new OnlineMapsDrawingLine(points, Color.green);
OnlineMaps.instance.AddDrawingElement(route);
Vector2 center;
int zoom;
OnlineMapsUtils.GetCenterPointAndZoom(points.ToArray(), out center, out zoom);
OnlineMaps.instance.zoom = zoom;
OnlineMaps.instance.SetPosition(center.x ,center.y);
var distance = OnlineMapsUtils.DistanceBetweenPoints(points[0], points[points.Count -1]);
Debug.Log("Distence" + distance);
}
else
{
Debug.Log("Find direction failed");
}
}
and here is error
You have a very difficult route, which has a lot of points, so that the drawing element has more 65,000 vertices.
We'll fix it.
I think it will take 1-2 days.
@Alex,
Have you fixed it?
Hello.
Yes, this bug has been fixed in Online Maps v2.4.0.56.
Infinity Code Forum → Online Maps Help → Find distance , direction b/w two places
Powered by PunBB, supported by Informer Technologies, Inc.