Walking is the simplest form of locomotion. It probably is the most democratic one too, at least for able-bodied beings. At the same time, walking as a way to move from place to place has lost some of its prevalence, there are faster ways to reach your destination. Its slowness, however, is what makes it such an attractive activity for exploration, investigation, daydreaming, or, on the other hand, meditation.
For me, walking is as much about moving as it is about looking. The hours and hours I’m walking, camera in hand, looking for interesting subjects, looking for small details often overlooked. Creating a photograph by moving back and forth, aligning the world around me through the lens of my camera.
There are times when I let my body and mind wander, letting me pull into different directions. Backtracking, exploring a side street, a yard, sometimes prompted by sight, sometimes sound, or sometimes even smell.
And then there are these other times when looking and walking aren’t those magical activities that one can get lost in. When I left the house full of anticipation of a walk, and then the magic doesn’t happen, the world does not align. Other times, I lack the motivation to even step outside, thinking that I have seen everything in my local surroundings anyway, nothing left to explore.
Being a software developer by day, I usually stay away from programming in my private time. I usually seek out the manual and often analogue ways in my private time, most definitely because I’m sitting in front of a computer all day for work. So I rarely try and find a solution based on software that I could write myself. However, this was one of the very few times during my career as a software developer where I actually thought that a software that I could write myself could actually help in getting me out of the house, away from screens, more often and in more interesting ways.
What if I could build myself a tool to override my “I have seen everything, nothing is left to explore” thinking and get me out of the house, ready to explore? After spending a few days here and there toying around with the idea, I’ve had a pretty decent first version of flânerie, a random amble walk generator.
flânerie can generate beautiful maps with random walking routes, like this example representing a roughly five-kilometre walk around the Nerima ward in Tokyo, Japan. To make it easier to follow the route in real-life, it generates a .gpx file which can be displayed by many smartphone apps, I use komoot which can also do turn-by-turn navigation).
I will now try and explain without too much technical jargon how flânerie works under the hood so far.
It is using the brilliant
osmnx library by Geoff Boeing which can load data from OpenStreetMaps and represent them as a graph structure where each intersection of different ways (road, street, footway, etc.) is represented as a node (or vertex in graph theory), and each connection between these vertices or nodes (the actual roads, streets, footways) are edges. Given other libraries that deal with networks and graphs, we can fairly easily write an algorithm which can generate random walks based on some characteristics of our choosing.
The path-finding algorithm is still early in its development, and at the time of writing, starts from the node at the centre of the map and:
- looks at all the immediate neighbours (other nodes having direct connections),
- ignores all nodes that are already included in the path (in an attempt to not pass the same nodes more than once, more on that later),
- calculates and applies a numerical weight to each edge (connection from the node to its neighbours) based on:
- the length of the connection (meters from node A to node B)
- the type of way it is (preferring smaller footways, residential streets, etc. over bigger roads)
- a randomly chosen multiplier (to ensure that the path is, in fact, random and cannot be generated again)
- and selects the connection with the maximum weight.
In case the algorithm ended up in a dead-end where it can only backtrack and visit a node that we’ve already visited, it calculates the length from the current node to all other nodes on the map that it hasn’t visited yet, and randomly selects one node from the closest 1 per cent of nodes.
For now, the software is still very rough around the edges, and unless someone is familiar with installing and running Python applications, it’s probably too early to try it out. Over the next months, I am testing out and refining the random path-finding algorithm. Eventually, I might package it up in a user-friendly web service.
Until then, I hope to explore and come back with many walk reports, photographs, and ideas to fine-tune the path-finding.