Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I was inspired by this visualisation, showing the optimal routes (by car) from the geographic centre of the USA to all counties.

The proverb “All Roads Lead to Rome” immediately came to mind and I set out to hack together something along that theme.

This is what was required:

1. Find a list of major cities in Europe and Asia.
2. Use OSRM to generate routes from each of these cities to Rome. This was slightly tricky. I used pmap() from {purrr} to loop over the cities. I had to be respectful of the load on the OSRM server and only make requests at a civilised cadence. I also had to handle exceptional conditions where the server returned an error. It took a iterations to get that right.
3. Generate a plot using {ggplot2}.

Here’s the result. The step size in some areas is a little large, but I’m pretty happy with it as a first attempt.

The code can be found here. Please be cognisant of the fact that there are many people querying the OSRM server. Consider either spinning up your own local server (see this post) or lowering the cadence of the routing queries. Alternative, feel free to greb an RDS with the routing data here.