Hello,
I am working with the google maps API, running routes, which I have working just fine. What we are trying to do now is plot fuel stops along that route.
I am able to get fuel stops that are within the bounds (rectangle) that googles api provides, but when it comes to plotting only fuel stops that are within say 25 miles of the route I am running into problems. I do have it working, but I have to loop through each fuel stop and check it against each point on that line.
One of my test routes is a route from Nebraska to California, so there is like 7600 points along that route.
As you can see, the loop takes a long time, if I return 75 fuel stops, I have to loop 75 times, checking each one agaist the 7600 points.
I am breaking out of the loop if I find a distance within my threshold, but it is still taking too long.
First off, has anybody worked with something similar to this?
I have found some examples on the web, but they seem to call javascript that is not include in the web page, therefore I can not see it.
I am guessing there must be a way to narrow something down, whether it be the number of points along a the line/route, or the number of fuel stops returned.
Any suggestions?
Thanks so much.
- Chris
I am working with the google maps API, running routes, which I have working just fine. What we are trying to do now is plot fuel stops along that route.
I am able to get fuel stops that are within the bounds (rectangle) that googles api provides, but when it comes to plotting only fuel stops that are within say 25 miles of the route I am running into problems. I do have it working, but I have to loop through each fuel stop and check it against each point on that line.
One of my test routes is a route from Nebraska to California, so there is like 7600 points along that route.
As you can see, the loop takes a long time, if I return 75 fuel stops, I have to loop 75 times, checking each one agaist the 7600 points.
I am breaking out of the loop if I find a distance within my threshold, but it is still taking too long.
First off, has anybody worked with something similar to this?
I have found some examples on the web, but they seem to call javascript that is not include in the web page, therefore I can not see it.
I am guessing there must be a way to narrow something down, whether it be the number of points along a the line/route, or the number of fuel stops returned.
Any suggestions?
Thanks so much.
- Chris