All Roads Lead to Rome

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: Find a list of major cities in Europe and Asia. Use OSRM to generate routes from each of these cities to Rome.

Using Shared Memory with OSRM

If you have multiple applications accessing OSRM data then it does not make sense for each of those to have a separate copy of the data resident in memory. This is especially true if you’re using a relatively large map, in which case memory consumed by multiple processes might be enormous. An alternative is to store the map data in shared memory, allowing multiple processes to access a single copy of the data.

Using Large Maps with OSRM

How to deal with large data sets in OSRM? Some quick notes on processing monster PBF files and getting them ready to serve with OSRM. Something to consider up front: if you are RAM limited then this process is going to take a very long time due to swapping. It might make sense to spin up a big clound instance (like a r4.8xlarge) for a couple of hours. You’ll get the job done much more quickly and it’ll definitely be worth it.

Running OSRM with Docker

I’ve now been through the process of setting up OSRM a few times. While it’s not exactly taxing, it seemed like a prime candidate for automation.

Building a Local OSRM Instance

The Open Source Routing Machine (OSRM) is a library for calculating routes, distances and travel times between spatial locations. It can be accessed via either an HTTP or C++ API. Since it’s open source you can also install locally, download appropriate map data and start making efficient travel calculations. These are the instructions for getting OSRM installed on a Ubuntu machine and hooking up the osrm R package.

Installing MicroPython on a ESP-32

STUFF FROM THE PYCON TEAM: An excellent reference is the official MicroPython one here. Install CP210x drivers Find out COM port (in this case COM3) https://www.mathworks.com/help/supportpkg/arduinoio/ug/find-arduino-port-on-windows-mac-and-linux.html esptool.py –chip esp32 –port COM3 erase_flash wget http://micropython.org/resources/firmware/esp32-20180511-v1.9.4.bin Note that this is now an old firmware esptool.py –chip esp32 –port COM3 write_flash -z 0x1000 esp32-20180511-v1.9.4.bin Putty over serial to COM3 with baud rate 115200 import webrepl_setup On flash, the AP mode was not enabled import network sta_if = network.