Skip to main content

Across the Strait

· 4 min read
Massimo Di Stefano
FastGIS author

The routing graph used to stop at Tarifa. It now crosses the Strait of Gibraltar and runs down the Atlantic road to Dakar, east along the Sahara to the Nile, and on into Arabia. Morocco, Tunisia, Egypt, Mauritania and Senegal also come as offline country packs on the phone.

One graph, not two​

The first instinct was a separate Africa tileset, but it could not work. The routing engine cuts the world into tiles of 4°, 1° and ¼°. The 4° tiles straddle the Strait (Tarifa and Tangier share one) and the Sicily channel, and Spain's own map data includes Ceuta and Melilla. Two separate builds would disagree about those shared tiles, and a phone cannot mix packs from two builds in one folder.

So North Africa joined the regular quarterly rebuild. That run downloads the 36 European countries and now also eight extracts from Morocco to the Gulf. They are merged into one file and built into one graph: 28,735 tiles, against 17,418 for Europe alone. The ferry from Tarifa to Tangier is in it, and so is the border at Ceuta.

Elevation had to come too. Our hill data stopped around 28°N, so about a thousand one-degree squares of the Copernicus 30 m elevation model were fetched and converted. Desert climbs now have a grade like Alpine ones.

The road to Dakar was closed by our own safety margin​

The North African routes avoid the mapped mine strips along the Berm and the military zones; those areas are never routed through. The exception is the official roads that cross them, which keep a narrow corridor. The most important one is the N1 through Guerguerat, the only road from Morocco to Mauritania.

On the first live test, Dakhla to Nouadhibou answered "no path".

Two separate mistakes, each enough on its own:

  • The corridor was drawn one OpenStreetMap way at a time, with square ends. Where two ways meet at a bend, the square ends leave a sliver of the zone outside the corner, and its tip lands exactly on the road. The engine treats a road that touches a zone boundary as crossing it, so four such corners closed the N1.
  • Only roads touching a zone got a corridor. The zones are grown by about 110 m as a safety margin before the corridors are cut out. The first Mauritanian stretch of the N1 starts about 100 m from the strip, so it had no corridor, and the margin closed it.

With both fixed, Dakhla to Nouadhibou routes along the N1: 432 km, with the red "stay on the road" warning through the strip. The same two mistakes had been forcing quiet detours elsewhere. Nouakchott to Atar was 524 km and is now 440; Cairo to Siwa was 826 and is now 736.

We could only find this on real tiles. The unit tests had checked that no zone contains the road; the engine cares whether a zone touches it. The tests now check that.

How fast​

A long desert leg answers in under a second, with a median of 0.9 s on the live server. The slow ones are in cities, not in the desert. Greater Cairo is ringed by hundreds of mapped military compounds in the densest street grid of the region, and the engine checks every nearby street against every compound outline: Cairo to Siwa takes 7 s. That is the next thing to fix.

What a desert track is worth​

Measured on the new graph: the engine files OpenStreetMap's surface=sand under gravel. So the arrival time on a sand piste is worked out like gravel (25 km/h for a 4x4 or an adventure bike), the most optimistic speed for the slowest ground. Real desert speeds are the next piece of the 4x4 work, and this measurement is where it starts.

Not there yet​

  • No closed-gate data for these countries offline: the OpenStreetMap mirror we query holds Europe only.
  • No dirt passages layer south of the Strait yet.
  • Libya, Algeria and the Gulf states route online but have no offline pack.

The same rebuild also refreshed Europe's map data and opened Norway's and Denmark's tracks that carry no access tag to motor vehicles. Every installed routing pack now shows update available once. Update all your countries: a phone does not mix two builds.