Key:wikimedia_commons:path

From OpenStreetMap Wiki
Jump to navigation Jump to search
Public-images-osm logo.svg wikimedia_commons:path
Description
Draws a line over specified wikimedia_commons=* image.
Group: annotations
Used on these elements
may be used on nodesmay be used on waysmay be used on areas (and multipolygon relations)may be used on relations
See also
Status: in use

Draws a line over specified wikimedia_commons=* image.

This tag is experimental according to Any_tags_you_like rules.

Usage

The value consist of x,y coordinates in percent units, which are separated with pipe character ("|"). We need to fit the value in 255 characters limit. This tag is always used in pair with the image definition like this:

  • wikimedia_commons = File:Roviště - Monolit.jpg
  • wikimedia_commons:path = 0.682,0.823|0.642,0.453|0.557,0.177

This instructs the consumer to create 3 points over this image File:Roviště - Monolit.jpg:

  1. x: 68.2% y: 82.3%
  2. x: 64.2% y: 45.3%
  3. x: 55.7% y: 17.7%

The result could look like this:

Image overlay example.jpg.png

This example can be found here: openstreetmap.org/node/11570960584 or in beta viewer app here.

Refential implementation

function parsePath (path){
  return path.split('|')
    .map((coords) => coords.split(',', 2))
    .map(([x, y]) => ({
      x: parseFloat(x),
      y: parseFloat(y),
    }));
}
    
parsePath('0.682,0.823|0.642,0.453|0.557,0.177'); // returns array of points

Climbing extension

The path can be also extended with point types. We experiment with adding one letter as a specifier. Used on climbing=route or climbing=route_bottom elements (see Climbing page).

For eg. wikimedia_commons:path = 0.682,0.823|0.642,0.453B|0.557,0.177A would mean: the 1st point is "normal", the 2nd point is a "bolt" and the last is an "anchor".

Currently used types:

  B: 'bolt'
  A: 'anchor'
  P: 'piton'
  S: 'sling'

More images

More images can be added with number suffix according to Multiple values rules, eg:

  • wikimedia_commons = File:imageA.jpg
    wikimedia_commons:path = ...
  • wikimedia_commons:2 = File:imageB.jpg
    wikimedia_commons:2:path = ...

See discussion here.

Longer path than 255 chars

In exceptional case, user could need more points than fits in 255 characters limit (~20 points). The tag could be possibly split in two with #number suffix, eg:

  • wikimedia_commons = File:imageA.jpg
    wikimedia_commons:path = ...
    wikimedia_commons:path#2 = ...
  • wikimedia_commons:2 = File:imageB.jpg
    wikimedia_commons:2:path = ...
    wikimedia_commons:2:path#2 = ...

It was suggested in this issue as a possible workaround until it is resolved, though it is not used in OSM yet.

Other idea could be using some binary format like Protobuf or Polyline algorithm, but it would make it unreadable for humans (eg. FfjavOpIcrApH_fBt{BknAhtAvn). This makes ~3chars/point, which could fit ~80 points in single tag (current schema above fits ~20 points which is probably enough).