Which is the highest bus stop near me? OSMnx helps me to answer
Posted by alan_gr on 27 July 2025 in English.Recently Malaga’s bus route number 37 was extended to Residencia Santa Clara in the hills outside the city. This part of the route had been suspended for a few years, and I knew that some stops had been relocated in the meantime. So I took the bus to the last stop to update the mapping in OpenStreetMap.

As I walked back towards the city down a steeply sloping road (pausing to tag it as https://wiki.openstreetmap.org/wiki/Tag:sidewalk=no), I wondered if I had just visited the city’s highest bus stop. I could probably have confirmed this fairly quickly with the help of a relief map - there were only a few realistic candidates.
But I happened to be looking at the OSMnx Python package for unrelated reasons. And I had already downloaded Digital Terrain Model files covering the city of Malaga. Obviously destiny wanted me to take a library intended for analysing important questions about urban road networks, and use it to devise an over-engineered answer to my trivial question about bus stops.
Bus stops in Malaga are fairly consistently mapped with both https://wiki.openstreetmap.org/wiki/Tag:highway=bus_stop where passengers wait, and https://wiki.openstreetmap.org/wiki/Tag:public_transport=stop_position on the road itself. As the latter are naturally part of the road network that OSMnx analyses, it only required a few lines of code
to get the estimated elevation of all the stops and plot them, with warm colours representing higher stops. As I expected, the highest stops are to the north and east of the city.
Link to interactive version
Looking at stops served by the city bus operator EMT, it turned out that my instinct was correct. Residencia Santa Clara, at 191 metres, is indeed the highest stop. Its only competition comes from route 34, further to the east, with a couple of stops above 180 metres.

But what if we include other operators that run services to other areas, but with stops inside the municipality of Malaga? This changes the picture:
Link to interactive version
The highest stops are now far to the northeast, near the settlement of Olías. And the highest of all, appropriately named “El Monte”, at an impressive 473 metres, leaves the EMT stops far below.

As it happens, I took a photo of that stop earlier this year, after following a hiking trail up from the coast. It might have been nice to get there by bus and walk down, if it wasn’t for the inconvenient timetable - the only buses from Malaga leave at lunchtime on Monday and Friday.

Credits
- Bus stop data copyright OpenStreetMap contributors (of course!)
- Elevation data derived from digital terrain model files provided by the IGN (MDT02-cob2 2015-2021 CC-BY 4.0)
- Elevation calculations using the OSMnx Python package, adapted from the excellent Examples Gallery, especially Example 12 . Any impression I may have given that I knew what I was doing during this whole exercise is due to OSMnx.
Discussion