Short URLs in OSM

When providing URLs for the documentation, for example, in posters or with QR codes, the URLs are very long and difficult to type, or they generate QR codes with many dots (for high-resolution cameras). It will be interesting to have a URL shortening mechanism based on the osm.org domain; however, I don’t know where to post this idea.

Another thing could be to have a wiki mechanism that automatically provides a short URL for the articles.

This idea came from this poster with 3 tinyurls that point to the wiki.

2 Likes

There are a few tricks that allow you to shave off characters from OSM urls.

First, xyz.osm.org generally forwards to xyz.openstreetmap.org. This works for pretty much every first-party OSM resource.

Second, some OSM services have additional means to shorten URLs. For example:

  • The map has shortlinks.
  • This community forum allows you to omit topic titles and such from the URL. So this thread could be linked as community.osm.org/t/8748.
  • Some Wiki pages with long titles have user-created redirects. And you can omit the /wiki part of the URL for all wiki pages. (I wish MediaWiki allowed making those shorter URLs the default.)

So your example of
https://tinyurl.com/psavpbv4
could be
https://wiki.osm.org/JOSM/Guide

Just 3 extra characters (32 instead of 29) and it gives the user an idea what the link is about without having to open all 3 of them first.

And of course, if you want to shave off characters from a printed URL, omitting the https:// would be an obvious next step.

A good start would be to make links like my example above more easy to discover. This could be a good addition to the wiki sidebar alongside the existing “Permalink” feature.

7 Likes

There is even c.osm.org :smile:, so you can link to c.osm.org/t/8748.

6 Likes

As mentioned above, there are plenty of shortcuts that can cut down URL lengths. If there’s still interest in creating truly short URLs for the wiki, the URLShortener MediaWiki extention can provide this functionality, generating links such as https://w.wiki/4e. This sacrifices readability of the page name to create an even shorter URL.

For a demo, visit Special:UrlShortener on Wikimedia’s meta-wiki.

That means that extension should be installed in the wiki? Or how can I make it work?

You’re right - the extension would have to be installed on the OSM wiki for it to be able to shorten OSM wiki links. I should have made this clearer in my post.

In the absence of the UrlShortener extension, you can already get a relatively short URL using numeric page IDs or revision IDs (which make for better permanent links anyways).

To link to a specific page:

  1. Click “Page information” in the sidebar.
  2. Copy the “Page ID”.
  3. Prepend wiki.osm.org/?curid=.

For example, “Proposal:Scaled down streets that may be used for traffic safety education or as a type of a playground” can be reached at wiki.osm.org/?curid=200385. This link will work as long as the page hasn’t been deleted, even if it gets moved to a new title without leaving a redirect at the old title.

Sometimes you need to link to a snapshot of the page at a particular time. For example, in tagging discussions, it can often be helpful to prove that the wiki said something and ensure that your statement holds true when someone reads it in the future. To link to a specific revision of a page:

  1. (Optional) If you need to link to an older revision, click on the History tab and click on the specific revision you’re interested in.
  2. Click “Permanent link” in the sidebar.
  3. Copy the oldid URL parameter, that is, the number at the end of the URL.
  4. Prepend wiki.osm.org/?oldid=.

For example, the archived version of this successful proposal can be found at wiki.osm.org/?oldid=2139256. This link will persist as long as the page or revision hasn’t been deleted, even if the page history gets merged with another page’s history.

These links are around 25 characters long, which is longer than tinyurl.com but about the same as overpass-turbo.eu’s link shortener. If you want to go even shorter, osm.wiki now redirects to wiki.openstreetmap.org.

2 Likes