westnordost / osmfeatures

A dictionary of OSM map features, accessible by terms and by tags, for Java and Android.
Apache License 2.0
18 stars 9 forks source link

Being able to find country-specific features #23

Closed westnordost closed 3 weeks ago

westnordost commented 9 months ago

Currently, all (non-brand) features indexed globally. IIRC, thus, features that are country-specific can thus not be found by this library.

See https://github.com/streetcomplete/StreetComplete/issues/4916

valerio-bozzolan commented 1 month ago

Trying to understand the next actionable thing but it seems dictionary.getByTerm() already supports a filter by country :exploding_head:

https://github.com/westnordost/osmfeatures/blob/11a1c94cd5dbd3ff9f6bc0885fdcaa865a1e70a8/src/commonMain/kotlin/de/westnordost/osmfeatures/FeatureDictionary.kt#L192

https://github.com/westnordost/osmfeatures/blob/11a1c94cd5dbd3ff9f6bc0885fdcaa865a1e70a8/src/commonMain/kotlin/de/westnordost/osmfeatures/FeatureDictionary.kt#L432

https://github.com/westnordost/osmfeatures/blob/11a1c94cd5dbd3ff9f6bc0885fdcaa865a1e70a8/src/commonMain/kotlin/de/westnordost/osmfeatures/FeatureDictionary.kt#L432

mnalis commented 1 month ago

Trying to understand the next actionable thing but it seems dictionary.getByTerm() already supports a filter by country 🤯

Interesting, but does it work though?

Because StreetComplete seems to be sending that countryOrSubdivisionCode param in Things overlay, but the "Mail Drop Box" (amenity=post_box) doesn't show in search results (https://github.com/streetcomplete/StreetComplete/issues/4916).

So either countryOrSubdivisionCode in StreetComplete is null, or getByTerm() here doesn't work as advertised. It would need to be debugged.

westnordost commented 1 month ago

Nothing on the API would need to be changed to accommodate this feature, correct.

The postbox feature is also in the dictionary. It is just not indexed (and the search uses exclusively the indices to search)

mnalis commented 1 month ago

What I find interesting that while searching for postbox also fails in SCEE Things Overlay, SCEE also has long-press-to-Add-POI feature, and that one manages to find "Mail Drop Box" (amenity=post_box) just fine!

However, tracking what it does differently is beyond my capabilities; but there seems to be some way (perhaps not using indexes, but I do not notice that search is any slower -- it is relatively recent phone [Samsung Galaxy S23+] though, so it may be it is just too fast to notice)?

small_Screenshot_20241003_170720_SCEE small_Screenshot_20241003_170748_SCEE

westnordost commented 3 weeks ago

Actually, it is indexed. I was wrong about the source of streetcomplete#5945 all along!

Also, it looks like finding country-specific features also is already working, all along! There was a small bug, but it should actually not matter.

So, I am now investigating where the real culprit lies.

westnordost commented 3 weeks ago

closing as invalid