Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am trying to calculate drivetime from the polygon. The scenario is this I generate a polygon based on specific location lat and LNG and drivetime. After that, the user is allowed to modify the polygon based on which drivetime should be adjusted according to the updated polygon.

What I have tried:

I have tried to use Google API, but they all required origin, destination and polygon coordinates so I think the drivetime would be calculated based on from origin to destination and not what I need. I tried StackOverflow posts but they are all creating polygons using drivetime but I need the opposite of that.
Posted
Comments
[no name] 7-Jun-23 19:49pm    
If is says "polygon", it means it's not a straight route, and you have to add each "leg" of the trip to get the total distance (a leg is the distance from one point to the next). Then you can start thinking about time. (average speed and "overhead").
Maisum Abbas 8-Jun-23 8:12am    
For now I am thinking of calculating drivetime for each vertex with the origin. And then I will take an average of that.
[no name] 8-Jun-23 8:49am    
Instead of passing a "polygon", iterate, and pass "point pairs". That way you get individual distances.
Maisum Abbas 8-Jun-23 8:58am    
Do you think that one of these methods would give us a satisfactory distance through which I would calculate a drivetime based on average speed let's let say 60.
[no name] 8-Jun-23 9:20am    
No other calcs needed. Just pass a "leg at a time" (2 points); Google then gives the distance you want for each leg.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900