Skip to content

bayesiandog/Garbage-Truck-Router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Garbage Truck Router

image

This is a Garbage Truck Route simulator. Drag and drop a .txt file containing a list of coordinates like coordinates.txt:

40.7278, -73.9964
40.7284, -73.9962
40.7291, -73.9960
40.7298, -73.9958
40.7305, -73.9956
40.7312, -73.9954
40.7319, -73.9952
40.7326, -73.9950

This app will get the directions for that route and visualize the driving route inside the app's window. User can drag and drop a different file inside the already created map.

image

Inner Workings

An OSRM request is made with the coordinates obtained from the drag and dropped .txt file. The polyline from the response containing the route is used to create a folium map with markers showing the distance between each dumpster. Last dumpster also shows total driving distance.

Coordinates

coords = ";".join(f"{coord[1]},{coord[0]}" for coord in coordinates)

Request

url = f"https://router.project-osrm.org/route/v1/driving/{coords}"
response = requests.get(url)
res = response.json()

Polyline

poly = polyline.decode(res['routes'][0]['geometry'])

Folium route

folium.PolyLine(poly, color="red", weight=2.5, opacity=1, dash_array='10').add_to(map)

About

Coordinates to driving route on a map.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages