osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.67k stars 1.02k forks source link

Show Wikimedia Commons photos that depict the Wikidata object (P180) #13926

Closed jluttine closed 10 months ago

jluttine commented 2 years ago

🚀 feature request

Description

Currently, OsmAnd shows photos that are explicitly listed in Wikidata. However, Wikimedia Commons contains a lot of photos that aren't explicitly listed on Wikidata side but rather marked as depicting Wikidata objects.

Here is one object (Siilinkari winter cafe) that I happened to work on today:

https://osmand.net/go?lat=61.51757&lon=23.75392&z=18

It has one image explicitly marked on Wikidata side, and that is shown by OsmAnd.

https://www.wikidata.org/wiki/Q62619389

Here is a query to Wikimedia Commons which lists all photos that are marked as depicting this particular Wikidata object:

https://w.wiki/4xDA

In this case, it lists two photos, that is, just one photo more. But there are many examples for which there might be zero or just one photo on Wikidata side although there can be many photos on Wikimedia Commons side marked depicting that object.

Note that Wikidata object key is all that is needed. The query on Wikimedia Commons side is based on that.

Also, on Wikimedia Commons side, it is extremely convenient to use this "Depicts" tag to list objects shown in the photo. So, the workflow on both sides is extremely convenient.

Describe the solution you'd like

Query Wikimedia Commons for photos that are tagged as depicting the Wikidata object and show those photos in OsmAnd.

Wikimedia Commons has a property called "Prominent" which tells whether the tagged object is prominent in the photo. It seems that the query example I gave, shows only the "prominent" photos, not others. It might be nice if all photos were shown, but just sorted so that the "prominent" photos were shown first.

One benefit of this solution is that compared to, for instance, using Wikimedia Commons Categories, there's significantly less manual inputting of structural data on Wikimedia Commons side. It's very easy to just list all objects that are clearly visible in a photo, but figuring out what categories there exist or should exist and putting the photos to those categories (and creating new categories and managing their hierarchy) and then figuring out on OsmAnd side what Category/Categories should be searched for, it's a much bigger mess, with inferior result. Just find the photos that show the particular object, that's it.

vshcherb commented 2 years ago

Query:

SELECT ?file ?image WHERE {
  ?file wdt:P180 wd:Q62619389.
  ?file schema:url ?image.
}

Result:

[
{
 "file":"https://commons.wikimedia.org/entity/M980796",
 "image":"http://commons.wikimedia.org/wiki/Special:FilePath/Siilinkari.jpg"
},
{ 
 "file":"https://commons.wikimedia.org/entity/M115537432",
 "image":"http://commons.wikimedia.org/wiki/Special:FilePath/Siilinkari%20Tampere.jpg"
}]
vshcherb commented 1 year ago

This could be related to https://github.com/osmandapp/OsmAnd/issues/12303 if

vshcherb commented 1 year ago

To do:

vshcherb commented 1 year ago
vshcherb commented 11 months ago

To developers on regular update:

dpriskorn commented 10 months ago

Hooray 🎉 I can't wait to test this out 🤩

jluttine commented 7 months ago

Big thanks!! :tada: I suppose this is now in OsmAnd 4.6.14? It seems like that, but at least one node isn't showing the photos for me in OsmAnd..

The node: https://www.openstreetmap.org/node/9578634049

The wikidata page: https://www.wikidata.org/wiki/Q111243500

The three photos: https://commons-query.wikimedia.org/#%23cache-control%3Ano-cache%0A%23defaultView%3AImageGrid%0ASELECT%20%3Ffile%20%3Fimage%20WHERE%20%7B%0A%20%20%3Ffile%20wdt%3AP180%20wd%3AQ111243500.%0A%20%20%3Ffile%20schema%3Aurl%20%3Fimage.%0A%7D

There are three photos but OsmAnd doesn't show any of those to me. Any ideas why?