Drunks of the world rejoice, for today a centuries-old problem has been solved. I have created an app that will tell you the shortest path to your bed while stopping at N bars on the way. You can select you mode of transportation: walking, biking or driving.

Try it today by visiting my server at http://shiny.simoncoulombe.com/shiny/crawlhome/ using username guestand password room. Clicking “get me home” will have you hang for about 10 seconds before showing the map. More bars = more waiting time.

Origin and destination locations are geocoded using the opencage package. The pubs and their location between these two points are found using the osmdatapackage. The crawling/biking/driving duration between all the points is found using the openrouteservice-r package using a ors_matrix call . I then use a custom version of A* pathing I built to find the shortest path that will vist N bars on the way to my bed. The directions are then downloaded, from the openrouteservice API, this time using the ors_directions and finally mapped using leaflet. The code is available on github.

crawlhome

crawlhome