I started to wonder whether we should use Wikidata instead of wiki-needs-pictures.
Advantages of Wikidata:
Advantages of wiki-needs-pictures:
All of the API requests we need (and more) can be found in the new WikiShootMe: https://tools.wmflabs.org/wikishootme/
When this WDFIST issue is fixed, I think we should also link to WDFIST like WikiShootMe does. For Wikidata items that do not have an image, it proposes some found on the Wikipedia articles linked to this item. Extremely useful before deciding whether walking that 2 kilometers detour is really worth it.
I'm not familiar with either of these APIs, but using Wikidata sounds like the more flexible and future-proof way to go. The main point against WD right now, as I see it, is "most missing pictures are actually available on Commons". Maybe there could be a side project to add an extension that suggested Commons pictures as well, based on coordanate proximity and/or names?
The "special requests" bit doesn't sound like a complete showstopper to me: If the inside of a building is particularly interesting, isn't it often because there's a special piece of art inside, which may have its own WD item? I honestly don't know how commonly or rarely that happens.
@LarsSimonsen The WDFIST paragraph in my post above could help solve this "unused pictures" problem. Unfortunately I have not been able to make it work on Android, as described at the link.
Indeed, I am not sure there are that many "special requests". We should try to estimate their number. I agree with your assertion that it is not a show-stopper. By the way, it is not implemented in wiki-needs-pictures either.
I am a strong supporter of switching to a Wikidata-based list. This is exactly what is needed. Currently there is usually 1-2 picture opportunities in your neighborhood. Using Wikidata there are dozens which are just a few hundred meters from you - which really turns this into an exciting challenge! Manually updated lists are usually boring and outdated in many language editions.
We are using a WD query to search for nearby items and it works perfectly:
http://tinyurl.com/h3ncs53
edit: or WD query for items without picture here:
http://tinyurl.com/gn9djdu
About the special request pictures: I think there are basically 2 common cases, which we can currently not solve, but that might be something for the next grant:
1) Places with existing images and details missing: A campaign is created with specific requirements: Select all churches nearby and send the user there to take pictures of the interior. -> So this is basically just a campaign with a campaign description.
2) Even more specific requests, where each item in the list needs a description. For this we could host a list on a server and let users enter coordinates and request texts themselves. This could look similar to the campaigns in the app.
In both cases the problem is that we need to allow the user to check off items from the list, as the query will not be able to show if an image has been taken. For something like WLM of course there is no checking off, because multiple people can visit one place during the campaign.
And another thing for the future about the problem of places that already have images:
Maybe the app also needs sort of an item-page. For example a user could click on an item in the nearby list and then see all the images that are on Commons in the items' category. Then the user can select an appropriate image and it could be added to Wikidata automatically using OAuth.
@tobias47n9e : Thanks for the analysis!
I believe WDFIST covers your last paragraph, so better just link to WDFIST from our app than reimplement it, I would say.
About your before-last paragraph I created this issue: https://github.com/alemela/wiki-needs-pictures/issues/25
Any thoughts on the use of this API? http://tools.wmflabs.org/articles-by-lat-lon-without-images/index.php?wiki=en&lat=51&lon=-0.1&radius=10000&reencode=true
The Pebble watch app by Sage Ross uses it, and it seems to give me good results. We could let the user pick which wiki they want, so maybe it would work for non-English locations? I tested with a point in Japan (can't read Japanese so no idea if the results are relevant though): http://tools.wmflabs.org/articles-by-lat-lon-without-images/index.php?wiki=jp&lat=36&lon=138&radius=10000&reencode=true
Also not sure how often it is updated.
What is the advantage of this articles-by-lat-lon-without-images API, compared to the Wikidata API? Simpler syntax? Faster maybe?
A problem is that it seems to only consider the articles of a single Wikipedia, for instance "en".
Based on what I have read about the articles-by-lat-lon-without-images API, I thought that the advantage would be negating this issue:
On Wikidata most missing pictures are actually available on Commons and just not linked yet
Or am I misreading that?
Also, err, I could potentially reuse some code from the Pebble app's GitHub repo, haha. :) It is written in JS, but still helpful.
Interesting approach, thanks! Too bad it does not get more languages wikipedias, for instance the user's language + English + the languages used at the specified location.
By the way, the API internally just gets articles and parses them to check whether they contain an image: https://github.com/Abbe98/articles-by-lat-lon-without-images-service/blob/master/index.php so no need for updates, it is real-time, I think. I am afraid this approach might be fooled by transcluded images though.
Using this API means we don't get important items such as this one: https://www.wikidata.org/wiki/Q26589362 because it does not have a Wikipedia article, despite being on UK's National Heritage List.
Also, it seems not all data comes up, I submitted an issues about that: https://github.com/Abbe98/articles-by-lat-lon-without-images-service/issues/4
Ah okay, thanks for the feedback @nicolas-raoul !
I improved the Wikidata query, try it!
It now displays each item's label and type (if available) in the user's language, so an anglophone will see "Eiffel Tower (building)" while a Japanophone will see "エッフェル塔 (建物)" for instance. This can be useful to add a bit of information to map markers or list details. I also introduced the "class" column for icons, because QIDs are much more stable than labels.
By the way, is it planned to be developed soon? I believe we all agree that it would be a huge improvement over downloading a huge CSV file each time :-)
Awesome! :)
@nicolas-raoul We are planning to work on it during the pre-hackathon/hackathon, and if needed I'll wrap up any loose ends afterwards.
I'm trying to produce a minimum viable product of this, hopefully by the hackathon. In any case, by trying, I hope I can see how much work needs to be done for completing the transition.
By "minimal" I mean Wikidata-derived icons etc would not probably be included by then, for example.
@whym: Wonderful!
If you have any kind of Wikidata/SPARQL question don't hesitate to ask me :-)
That would be great, thanks @whym ! Even if it doesn't fully work, it would be nice to have a base to start from during the pre-hackathon.
Here is the query I'm using. It's mostly yours @nicolas-raoul, with slight modifications.
I tried including emojis in the results - they may render consistently than icons to the user. On the other hand, icons cover a larger range of things.
How do I properly do the recursive searching of the nearest superclass' icon/emoji? For example, when both "hospital" and its superclass "building" have an icon, a simple property path expression returned the "building" icon for me, which is not ideal.
EDIT: query changed.
Unfortunately there is no recursion structure in SPARQL, but here is how you could do it.
@whym You are right that Wikidata contains many false positives (Wikidata items without a picture even though the Wikipedia article has pictures). However:
@nicolas-raoul Also HarvestTemplates is very useful for getting images from Wikipedia to Wikidata in an automated way : https://tools.wmflabs.org/pltools/harvesttemplates/
I've pushed the new release with Wikidata queries to beta (v2.2), so please opt in to beta testing and help us test it. :) Will leave this thread open for feedback for a few days, then will close and push to production if no issues.
I think @VojtechDostal is having some issues with the new Nearby function as mentioned at #506 :
I also tried to load "Nearby" items, but they don't seem to load at all. The window remains blank.
@VojtechDostal https://github.com/VojtechDostal Does pressing the refresh
button on the top-right corner work?
Is the permission to location granted to the app?
Can you share the location where you tried this? It could be
location-specific issues. If you want to keep it private, you can send to
[email protected] or [email protected].
Also, if you can, providing a larger portion of the logs containing tags
like NearbyPlaces, NearbyListFragment, LocationServiceManager will help a
lot. (Again, please be aware that this might contain personal information
regarding locations.)
On Sun, Apr 16, 2017 at 10:34 AM, Josephine Lim notifications@github.com
wrote:
I think @VojtechDostal https://github.com/VojtechDostal is having some
issues with the new Nearby function as mentioned at #506
https://github.com/commons-app/apps-android-commons/issues/506 :I also tried to load "Nearby" items, but they don't seem to load at all.
The window remains blank.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/commons-app/apps-android-commons/issues/289#issuecomment-294327871,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAApsvVVlJLhiRfN7pdw3TYsZLjI0ySVks5rwXAsgaJpZM4KQtge
.
Pressing the refresh button does nothing. It doesn't even display any action in logcat. The app used to work before quite nicely, so my theory has been that it has something to do with the beta.
I am trying it in Prague. Is that specific enough? :-)
When I open the app, remove the preexisting content of the logcat and then press "nearby", this is what I get:
04-16 10:05:35.484 170-170/? E/BufferQueueCore: [PopupWindow:209c83b4] setDefaultMaxBufferCount: setting count to 3, previous is 2
04-16 10:05:35.854 751-1153/? E/Watchdog: !@Sync 565 [04-16 10:05:35.866]
04-16 10:05:38.357 19829-19829/? E/ViewRootImpl: sendUserActionEvent() mView == null
04-16 10:05:38.427 19829-19829/? E/MotionRecognitionManager: mSContextService = null
04-16 10:05:38.427 19829-19829/? E/MotionRecognitionManager: motionService = com.samsung.android.motion.IMotionRecognitionService$Stub$Proxy@c2764f1
04-16 10:05:38.467 170-170/? E/BufferQueueCore: [fr.free.nrw.commons/fr.free.nrw.commons.nearby.NearbyActivity] setDefaultMaxBufferCount: setting count to 3, previous is 2
04-16 10:06:02.911 751-764/? E/ActivityManager: failed to get LpnetManagerService instance or Pkg was null
04-16 10:06:05.854 751-1153/? E/Watchdog: !@Sync 566 [04-16 10:06:05.867]
04-16 10:06:35.853 751-1153/? E/Watchdog: !@Sync 567 [04-16 10:06:35.868]
and nothing happens. Does it help?
Still no idea. On my emulator (Android 7.1 equivalent), I get something like this for Latitude=50, Longitude=14.43.

Additional questions: What version of Android is it? Is "Use Wikidata" enabled on Settings? Can you try with another Android device?
@whym I tried testing this again (emulator, API 25) and got a blank screen on my first try, with the logs below. But the refresh button works for me, it loads normally upon refresh.
04-17 00:37:57.141: D/fr.free.nrw.commons.nearby.NearbyListFragment(2992): NearbyListFragment created
04-17 00:37:57.143: D/fr.free.nrw.commons.nearby.NearbyListFragment(2992): Saved instance state is null, populating ListView
04-17 00:37:57.143: D/fr.free.nrw.commons.nearby.NearbyListFragment(2992): Loading attractions near null
@VojtechDostal How are you getting your logs, are you using Android Device Monitor on Android Studio? If you are, go to the text box in the middle and type tag:fr.free there, and select "debug" from the drop down on the right. Then copy ALL the logs you see and paste here (don't worry about it being long, it shouldn't be excessively long with this method).
I have a screenshot below to show how to do it:

After today's update, I can open settings but the Nearby function still does not work, same behaviour as described above.
I am using Samsung Galaxy J3, Android 5.1.1.
Will try the @misaochan 's method when I have a little more time, possibly tonight or tomorrow morning
I chose "Debug" from the rollup menu and filtered the results for "fr.free" and this is what I got when I opened Nearby:
04-16 21:13:17.496 17609-17609/? I/InjectionManager: dispatchPrepareOptionsMenu :fr.free.nrw.commons.contributions.ContributionsActivity
04-16 21:13:27.856 17609-17609/? I/InjectionManager: dispatchOptionsItemSelected :fr.free.nrw.commons.contributions.ContributionsActivity
04-16 21:13:27.856 17609-17609/? I/Timeline: Timeline: Activity_launch_request id:fr.free.nrw.commons time:7116998
04-16 21:13:27.876 745-773/? D/StatusBarManagerService: manageDisableList userId=0 what=0x0 pkg=Window{2a60fd6 u0 d0 fr.free.nrw.commons/fr.free.nrw.commons.contributions.ContributionsActivity}
04-16 21:13:27.906 17609-17609/? W/ResourcesManager: getTopLevelResources: /data/app/fr.free.nrw.commons-2/base.apk / 1.0 running in fr.free.nrw.commons rsrc of package fr.free.nrw.commons
04-16 21:13:27.906 17609-17609/? W/ResourcesManager: getTopLevelResources: /data/app/fr.free.nrw.commons-2/base.apk / 1.0 running in fr.free.nrw.commons rsrc of package fr.free.nrw.commons
04-16 21:13:27.936 745-1305/? D/LocationManagerService: request 34c7533d gps Request[ACCURACY_FINE gps requested=+400ms fastest=+400ms] from fr.free.nrw.commons(10119)
04-16 21:13:27.946 17609-17609/? D/fr.free.nrw.commons.nearby.NearbyListFragment: NearbyListFragment created
04-16 21:13:27.966 17609-17609/? D/fr.free.nrw.commons.nearby.NearbyListFragment: Saved instance state is null, populating ListView
04-16 21:13:27.966 17609-17609/? I/InjectionManager: dispatchOnViewCreated > Target : fr.free.nrw.commons.nearby.NearbyActivity isFragment :false
04-16 21:13:27.976 17609-17728/? D/fr.free.nrw.commons.nearby.NearbyListFragment: Loading attractions near lat/lng: (50.07177629614689,14.456611949925886)
04-16 21:13:27.986 17609-17728/? D/fr.free.nrw.commons.nearby.NearbyPlaces: https://query.wikidata.org/sparql?query=SELECT%0A%20%20%28SAMPLE%28%3Flocation%29%20as%20%3Flocation%29%0A%20%20%3Fitem%0A%20%20%28SAMPLE%28COALESCE%28%3Fitem_label_preferred_language%2C%20%3Fitem_label_any_language%29%29%20as%20%3Flabel%29%0A%20%20%28SAMPLE%28%3FclassId%29%20as%20%3Fclass%29%0A%20%20%28SAMPLE%28COALESCE%28%3Fclass_label_preferred_language%2C%20%3Fclass_label_any_language%2C%20%22%3F%22%29%29%20as%20%3Fclass_label%29%0A%20%20%28SAMPLE%28COALESCE%28%3Ficon0%2C%20%3Ficon1%29%29%20as%20%3Ficon%29%0A%20%20%28SAMPLE%28COALESCE%28%3Femoji0%2C%20%3Femoji1%29%29%20as%20%3Femoji%29%0AWHERE%20%7B%0A%20%20%23%20Around%20given%20location...%0A%20%20SERVICE%20wikibase%3Aaround%20%7B%0A%20%20%20%20%3Fitem%20wdt%3AP625%20%3Flocation.%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Acenter%20%22Point%2814%2C457%2050%2C072%29%22%5E%5Egeo%3AwktLiteral.%20%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Aradius%20%221.0%22%20.%20%23%20Radius%20in%20kilometers.%0A%20%20%7D%0A%20%20%0A%20%20%23%20...%20and%20without%20an%20image.%0A%20%20MINUS%20%7B%3Fitem%20wdt%3AP18%20%5B%5D%7D%0A%20%20%0A%20%20%23%20Get%20the%20label%20in%20the%20preferred%20language%20of%20the%20user%2C%20or%20any%20other%20language%20if%20no%20label%20is%20available%20in%20that%20language.%0A%20%20OPTIONAL%20%7B%3Fitem%20rdfs%3Alabel%20%3Fitem_label_preferred_language.%20FILTER%20%28lang%28%3Fitem_label_preferred_language%29%20%3D%20%22cs%22%29%7D%0A%20%20OPTIONAL%20%7B%3Fitem%20rdfs%3Alabel%20%3Fitem_label_any_language%7D%0A%20%20%0A%20%20%23%20Get%20the%20class%20label%20in%20the%20preferred%20language%20of%20the%20user%2C%20or%20any%20other%20language%20if%20no%20label%20is%20available%20in%20that%20language.%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fitem%20p%3AP31%2Fps%3AP31%20%3FclassId.%0A%20%20%20%20OPTIONAL%20%7B%3FclassId%20rdfs%3Alabel%20%3Fclass_label_preferred_language.%20FILTER%20%28lang%28%3Fclass_label_preferred_language%29%20%3D%20%22cs%22%29%7D%0A%20%20%20%20OPTIONAL%20%7B%3FclassId%20rdfs%3Alabel%20%3Fclass_label_any_language%7D%0A%0A%20%20%20%20%23%20Get%20icon%0A%20%20%20%20OPTIONAL%20%7B%20%3FclassId%20wdt%3AP2910%20%3Ficon0.%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3FclassId%20wdt%3AP279%2Fwdt%3AP2910%20%3Ficon1.%20%7D%0A%20%20%20%20%23%20Get%20emoji%0A%20%20%20%20OPTIONAL%20%7B%20%3FclassId%20wdt%3AP487%20%3Femoji0.%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3FclassId%20wdt%3AP279%2Fwdt%3AP487%20%3Femoji1.%20%7D%0A%20%20%7D%0A%7D%0AGROUP%20BY%20%3Fitem%0A
04-16 21:13:27.996 170-170/? E/BufferQueueCore: [fr.free.nrw.commons/fr.free.nrw.commons.nearby.NearbyActivity] setDefaultMaxBufferCount: setting count to 3, previous is 2
04-16 21:13:27.996 745-773/? D/StatusBarManagerService: manageDisableList userId=0 what=0x0 pkg=Window{849ec83 u0 d0 fr.free.nrw.commons/fr.free.nrw.commons.nearby.NearbyActivity}
04-16 21:13:28.037 17609-17609/? I/InjectionManager: dispatchCreateOptionsMenu :fr.free.nrw.commons.nearby.NearbyActivity
04-16 21:13:28.037 17609-17609/? I/InjectionManager: dispatchPrepareOptionsMenu :fr.free.nrw.commons.nearby.NearbyActivity
04-16 21:13:28.367 745-775/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{1675a70b u0 fr.free.nrw.commons/.nearby.NearbyActivity t1874} time:7117502
04-16 21:13:28.397 17609-17728/? D/fr.free.nrw.commons.nearby.NearbyPlaces: java.io.FileNotFoundException: https://query.wikidata.org/sparql?query=SELECT%0A%20%20%28SAMPLE%28%3Flocation%29%20as%20%3Flocation%29%0A%20%20%3Fitem%0A%20%20%28SAMPLE%28COALESCE%28%3Fitem_label_preferred_language%2C%20%3Fitem_label_any_language%29%29%20as%20%3Flabel%29%0A%20%20%28SAMPLE%28%3FclassId%29%20as%20%3Fclass%29%0A%20%20%28SAMPLE%28COALESCE%28%3Fclass_label_preferred_language%2C%20%3Fclass_label_any_language%2C%20%22%3F%22%29%29%20as%20%3Fclass_label%29%0A%20%20%28SAMPLE%28COALESCE%28%3Ficon0%2C%20%3Ficon1%29%29%20as%20%3Ficon%29%0A%20%20%28SAMPLE%28COALESCE%28%3Femoji0%2C%20%3Femoji1%29%29%20as%20%3Femoji%29%0AWHERE%20%7B%0A%20%20%23%20Around%20given%20location...%0A%20%20SERVICE%20wikibase%3Aaround%20%7B%0A%20%20%20%20%3Fitem%20wdt%3AP625%20%3Flocation.%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Acenter%20%22Point%2814%2C457%2050%2C072%29%22%5E%5Egeo%3AwktLiteral.%20%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Aradius%20%221.0%22%20.%20%23%20Radius%20in%20kilometers.%0A%20%20%7D%0A%20%20%0A%20%20%23%20...%20and%20without%20an%20image.%0A%20%20MINUS%20%7B%3Fitem%20wdt%3AP18%20%5B%5D%7D%0A%20%20%0A%20%20%23%20Get%20the%20label%20in%20the%20preferred%20language%20of%20the%20user%2C%20or%20any%20other%20language%20if%20no%20label%20is%20available%20in%20that%20language.%0A%20%20OPTIONAL%20%7B%3Fitem%20rdfs%3Alabel%20%3Fitem_label_preferred_language.%20FILTER%20%28lang%28%3Fitem_label_preferred_language%29%20%3D%20%22cs%22%29%7D%0A%20%20OPTIONAL%20%7B%3Fitem%20rdfs%3Alabel%20%3Fitem_label_any_language%7D%0A%20%20%0A%20%20%23%20Get%20the%20class%20label%20in%20the%20preferred%20language%20of%20the%20user%2C%20or%20any%20other%20language%20if%20no%20label%20is%20available%20in%20that%20language.%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fitem%20p%3AP31%2Fps%3AP31%20%3FclassId.%0A%20%20%20%20OPTIONAL%20%7B%3FclassId%20rdfs%3Alabel%20%3Fclass_label_preferred_language.%20FILTER%20%28lang%28%3Fclass_label_preferred_language%29%20%3D%20%22cs%22%29%7D%0A%20%20%20%20OPTIONAL%20%7B%3FclassId%20rdfs%3Alabel%20%3Fclass_label_any_language%7D%0A%0A%20%20%20%20%23%20Get%20icon%0A%20%20%20%20OPTIONAL%20%7B%20%3FclassId%20wdt%3AP2910%20%3Ficon0.%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3FclassId%20wdt%3AP279%2Fwdt%3AP2910%20%3Ficon1.%20%7D%0A%20%20%20%20%23%20Get%20emoji%0A%20%20%20%20OPTIONAL%20%7B%20%3FclassId%20wdt%3AP487%20%3Femoji0.%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3FclassId%20wdt%3AP279%2Fwdt%3AP487%20%3Femoji1.%20%7D%0A%20%20%7D%0A%7D%0AGROUP%20BY%20%3Fitem%0A
04-16 21:13:28.397 17609-17728/? D/fr.free.nrw.commons.nearby.NearbyPlaces: back to initial radius: 1.0
04-16 21:13:28.397 17609-17728/? D/fr.free.nrw.commons.nearby.NearbyListFragment: Sorting places by distance...
But nothing loads.
Thanks for providing the log. The problem appears to be that, in the query, the location is formatted like "Point(12,34 12,34)" using commas which should be "Point(12.34 12.34)" using periods. I'm guessing that we need to cancel the localization.
@whym do you think I should push another release to beta now? Or is there any other fix in the works?
@misaochan I'm not working on anything at the moment. I'd suggest releasing it and seeing if any other issues arise.
Rolled out the fix to beta, please test in a few hrs' time.
Woohoo yes it works now :-)
After the last update, list of nearby items loads and it is really the list of nearby Wikidata items. Very precise, with nice descriptions in my language.

Excellent. I will push the release to production, hopefully it works for everyone else too! :)
Time to close?
Not everything mentioned here has been done, but the remaining things should probably have their own issues. (e.g. WDFIST)
Yeah, agreed. :)
Most helpful comment
I improved the Wikidata query, try it!
It now displays each item's label and type (if available) in the user's language, so an anglophone will see "Eiffel Tower (building)" while a Japanophone will see "エッフェル塔 (建物)" for instance. This can be useful to add a bit of information to map markers or list details. I also introduced the "class" column for icons, because QIDs are much more stable than labels.
By the way, is it planned to be developed soon? I believe we all agree that it would be a huge improvement over downloading a huge CSV file each time :-)