What URL should be used when a feature links a image to wikimedia commons?

Hi,

I was wondering which URL format should be used to link a feature with the image=* tag.

For example:

Both URLs link to a valid image, but I’m not sure which URL scheme is preferred.

The canonical link is the one to the image embedded in a webpage, the first one in you list.

The other one is considered a deep-link where not guaranteed it remains.

BTW: There is also the “wikimedia_commons” tag to link to images. Some argue this is preferred over image?

1 Like

Consider setting wikimedia_commons=File:Inhalatorium - panoramio.jpg instead. (In iD, there’s an optional Wikimedia Commons Page field.)

If you use image=*, then there are at least three different possible URLs that correspond to a given Wikimedia Commons file. The two you give as examples both have significant usage, but both have drawbacks:

Oh, I know about wikimedia_commons=* and I exclusively use it. I’m asking about cases when a feature already has both wikimedia_commons=* and image=* tags.

I remember there was some disagreement awhile back on which tag should be used. So, I decided not to use the image=* and instead exclusively use wikimedia_commons=*. However, if a feature already has both image=* and wikimedia_commons=*, I want to ensure the image=* tag is correct.

Personally, I always use the File: link, regardless of key. Works both with the “image” and the “commons” key in my editor and some QA tools; just because my editor (JOSM) seems unbeknown of the “wikimedia_commons” key I happened to tag image instead. Helpful janitors correct that to wiki key, I have learned.

To repeat: The File: link on wikimedia is the canonical one. The other is not considered stable, users might get unexpected results.

Thanks for your detailed response. I have a question: doesn’t the https://commons.wikimedia.org/wiki/File URL format seem the best option? If someone uploads a newer version, having a link that goes bad would be catastrophic. While the https://commons.wikimedia.org link is not an image, it is more persistent. Is this a problem for data consumers? Do they have issues if the tag links to https://commons.wikimedia.org/wiki/File instead of https://upload.wikimedia.org/wikipedia?

This is at least a problem for OsmAnd:

A data consumer could add special logic to resolve a URL to a file description page to the canonical file name. However, I don’t think mappers can take this fallback heuristic for granted if they want to ensure that the image works.

The problem with both keys is that they presume a single best image to represent the feature, which isn’t always possible. At least wikimedia_commons=* can be set to a category name (beginning with Category:), which a data consumer can then resolve to a whole image gallery if it wants.

Using OsmAnd as a benchmark, we can infer that other data consumers might also have issues with image=*. Are there other examples of applications that either do or do not have problems with https://commons.wikimedia.org links?

According to an issue on the OsmAnd GitHub page, they support wikimedia_commons=*, eliminating the need for image=* altogether. This suggests that wikimedia_commons=* is the better option for displaying images in OsmAnd use case.