soundscape
soundscape copied to clipboard
Provide more filtering options of nearby places e.g., places to eat, parks, businesses etc
Apple MapKit (which replaced Bing as the search provider) does appear to provide some category filters we could use: https://developer.apple.com/documentation/mapkit/mkpointofinterestcategory
Which file would I edit to get started working on this?
The "Places Nearby" filtering happens here: https://github.com/soundscape-community/soundscape/blob/main/apps/ios/GuideDogs/Code/Visual%20UI/Helpers/Nearby%20Table/NearbyTableFilter.swift
Note that you can deduce the original filtering categories from the localized strings (the open-source release apparently purged them from the English localization, but not the others) : https://github.com/soundscape-community/soundscape/blob/main/apps/ios/GuideDogs/Assets/Localization/es-ES.lproj/Localizable.strings#L1842
See also the comments on #13. For an example of querying Apple MapKit, see PR #21.
I worked on the filter options for a bit and I was wondering if these filtering options worked. I implemented them a different way. Let me know if its good.
https://github.com/jonha1/soundscape/tree/test
Thanks for starting this! Please open a pull request so we can comment on specific items. You can mark it as a draft to prevent it from being merged before you've pushed more changes. A few preliminary comments:
First, it should always make you feel uncomfortable to compare localized and non-localized strings. Things are not going to have names like "museum" or "park" in non-English languages. But you're in luck, because the old category names are still in the localizations: https://github.com/soundscape-community/soundscape/blob/efcfa2605a3adb994c7e937685061509b251b5d3/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings#L3218
So, instead of:
localizedName.lowercased().contains("restaurant")
you just do something like:
localizedName.lowercased().contains(GDLocalizedString("osm.tag.restaurant").lowercased())
which will make sure you're looking for the name of the thing in the right language.
A more fundamental problem, though, is that you seem to be using place names rather than OSM tags. This is going to result in a lot of false negatives (restaurants with trendy names that don't mention "restaurant" or similar keywords) and false positives (like the "park" in "parking lot" case that you handle). But OSM already deals with this by providing lots of standardized metadata tags, e.g. https://wiki.openstreetmap.org/wiki/Key:amenity
So, for example, to identify a restaurant, you should match the OSM tag amenity=restaurant, which is independent of the place's name.
The app already associates OSN tags with the entity for at least some entity types: https://github.com/soundscape-community/soundscape/blob/efcfa2605a3adb994c7e937685061509b251b5d3/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM%20Entity/GDASpatialDataResult%2BExtensions.swift#L44
Finally, for tests, I'd like to see some cases that construct realistic-looking entities and show that they are classified appropriately.
Fixed in #101