[Feature]: Nearby: don't load places that already have a picture when only red pins are shown
What is the user problem or growth opportunity you want to see solved?
#7398 (for #6323) adds a button in Nearby to show only places that need a photo. It only hides the green pins though, the app still loads every place in the area first, so it isn't any faster.
Right now Nearby runs rectangle_query_for_nearby.rq to get every item with a location in the visible area (up to NearbyController.MAX_RESULTS = 1000). Then NearbyPlaceDetailsLoader.loadPlacesDataAsync fetches details for every one that isn't cached yet, 10 per request. Places that already have a picture go through the same requests and are only dropped when drawing the map.
How do you know that this problem exists today? Why is this important?
@OpenGreenStreet asked for it in https://github.com/commons-app/apps-android-commons/issues/6323#issuecomment-7093258399, slow loading in areas with lots of pins is one of the main things that bother them.
In busy areas most of those places already have a picture. I counted with the Wikidata query service (items with a location in the area, and how many have P18):
- central Paris, about 3x2 km: 4646 places, 3283 with a picture (70%)
- central London, about 3x2 km: 3998 places, 3005 with a picture (75%)
- central Delhi, about 4x2 km: 143 places, 43 with a picture (30%)
So in places like Paris or London, most of the detail requests are for pins that the toggle hides anyway.
Who will benefit from it?
People who use Nearby to find places that need photos, especially in busy areas.
Anything else you would like to add?
My idea: when the toggle is on, add MINUS {?item wdt:P18 ?image} to the area query (places_query.rq already does this), so places with a picture are never fetched. Turning the toggle off reloads the area with the normal query. I'd like to work on this and will open a PR for it shortly, building on #7398.
Assigned to you, @Medhansh-741! Thanks!
@nicolas-raoul @OpenGreenStreet opened #7409 for this. With the toggle on, places that already have a picture aren't fetched anymore, so in central Paris it loaded about half the data in about half the time on my phone, and the red pins cover the whole map area. It builds on #7398, would be great if you could give it a try.
@Medhansh-741 That's great. Thank you very much. I'm looking forward to this feature being released in a future version. Once it's available on the Play Store, I'll test it right away.