hn.today

Stable URLs for 42,000 Huts and Peaks

peter-hoffmann.com3 points0 comments
Screenshot of Stable URLs for 42,000 Huts and Peaks

biwak.info maps 42,866 Alpine huts, bivouacs and named peaks from OpenStreetMap. To make places shareable, it replaces name-based search links with short URLs such as /p/matterhorn. The challenge is that names repeat and the underlying map data changes: a URL must distinguish nearby places without making every address long, and it must continue identifying the same place over time. Testing suffix strategies showed that adding a country name barely reduces collisions, while a region helps more; elevation resolves most remaining duplicates. The chosen approach adds only as much detail as needed: name first, then region, elevation, and finally the OpenStreetMap identifier.

A committed registry preserves every slug already assigned, so a new place named Matterhorn cannot take the established address, and renamed places retain old URLs that redirect to their current ones. Regions come from tailored Natural Earth administrative boundaries, with nearby-region assignment for points outside simplified borders. Under the current scheme, 36,176 places use just their name; 2,758 add a region, 3,474 an elevation, and 458 need an OpenStreetMap id. Ambiguous shorter URLs open a search listing the matching places, while outdated id-based URLs redirect to the current address. The registry only grows, and changes to naming rules can affect thousands of links: correcting the treatment of German umlauts once changed 7,182 slugs.

Read on peter-hoffmann.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.