GMap sometimes fails to calculate route

Topics: General
Aug 29, 2013 at 9:11 AM
Edited Aug 29, 2013 at 2:40 PM
I try to calculate the route between 2 points with OpenStreet map, but sometimes it "waits" for several seconds and then returns null.

MapRoute route = OpenStreetMapProvider.Instance.GetRouteBetweenPoints(p1, p2, false, true, 15);

I tried changing the parameters of the method with no effect.
I did notice that it fails less when I try to put both locations exactly on a road. But if the method only works with coordinates exactly on roads, could someone tell me how to calculate the road between 2 points with start and end point as close to the input points as possible.

The input points are given by the mouse and are correct.

edit: I update to the hotbuild and changed to MapRoute route = OpenStreetMapProvider.Instance.GetRoute(p1, p2, false, true, 15);

still the same problem
Aug 29, 2013 at 2:44 PM
thats provider issue, you can try another
Sep 11, 2013 at 8:56 AM
Thanks, it helps!

I now calculate the route in a seperate thread to avoid that the GUI "hangs", but after the route calcuation I 'm not able to refresh the map to show the route.
It's not that the refresh doesn't work, it's only that I'm not able to call the refresh method (for the GMapControl instance) from another thread.
It's no issue with GMap directly but if anyone knew a solution that would be greatly appreciated.
Sep 11, 2013 at 9:28 AM
map.Invalidate() is thread safe by default
Sep 11, 2013 at 10:09 AM
Thanks, I tried it and got no problems to call the method but the route is still only drawn after I zoom in or out.