From OpenStreetMap Wiki
Jump to navigation Jump to search

Towards a short URL

Since the first year of operation with Openstreetmap in 2009, the OSM.ORG is used as a short alias for OPENSTREETMAP.ORG, redirecting to it.

... But for short reference to a map feature is not the shortest: we can reduce "/relation" to "/r", "/node" to "/n" and "/way" to "/w". For instance,
  http //
is 20 characters shorter than

And we can do better: instead to express the element ID as a decimal number, we can compact it expressing as a base-36 or base-58 number. Using base36, for instance, the decimal "298285" will be 30% shorter, "6E5P", and better to spell or audit by humans.
PS: the biggest possible ID, "9223372036854775807" is "1Y2P0IJ32E8E7" in base-36.

For other uses and advantages see short URL article.

Base36 prefix proposal

This is a first step to discuss and to polish the proposal. A general syntax and implementation architecture to express short URLs with the OSM.ORG domain. General syntax as regular expression:



$1 is a upper-case base36-digit representing the namespace selector;
$2 is the catalog mode indicator;
$3 is the identifier of an entity in the selected namespace.
Note: there are no need for "reserved words" as "NODE", "COPYRIGHT", etc. because all has lower-case first-letter names: /copyright, /export, /node, etc. The traditional redirection, in use since 2009, is preserved.

General syntax options as URL-templates:
The "root", redirects to the root of{namespace}/{name}
A "catalog" interface for all namespaces. To show metadata about the intention of the redirectin, to debug or check metadata. Can be a redirecion to something as{namespace}&id={name}.{namespace}{name}
The first-character-controled redirections. Can be a redirecion to something as{namespace}&id={name}.
... the 36 possible namespace options ...
For instance namespaces "N" for nodes, "R" for relations, "G" for Geohash, etc. all simple and fast redirections, each one with its namespace conventions.

Below all template URLs organized by upper-case letter namespace.

N R W mode

The "n, r or w" namespace, for OSM's elements (node, relation or way) and its 64-bit identifier represented in base36, for short URLs.{eleType}{ID_base36}
A compact expresion, starting by the first letter of the eleType ("n","r" or "w"), and followed by the ID, a positive 64-bit integer expressed in base36. Redirects as the traditional URL expanding ID to a decimal decID, "/node/decID", "/way/decID" and "/relation/decID".

Q mode

The Wikidata "Q-ID" used by elements with the key:wikidata.{wdId_base36}
The letter "Q" (same as "q") can be reserved for Wikidata value (the eternal "Q" ID) redirection, as specifyed by Permanent ID/Proposal-QID.

Other examples

Other for illustration, no relevance or discussion at now.

T mode

Short URLs to redirect to main statistical uses. Examples:

Towards a short PURL

... See Persistent Place Identifier and Permanent ID/Proposal-QID.