[MapBox lookup] Ommited result
Expected behavior
Using Mapbox as the lookup API I'm getting some ommited results
e.g -> "geometry"=>{"type"=>"Point", "coordinates"=>[X, Y], "interpolated"=>true, "omitted"=>true}
I want to accept these results as valid instead of ignoring and using the next one in the array.
Actual behavior
Geocoder actually ignores ommited: true results instead of using them
Steps to reproduce
Geocoder.search("Rua Egas Moniz 8, 1900-218, Lisboa")
Environment info
- Geocoder version:
1.8.3 - Rails version:
8.0.1 - Database (if applicable):
- Lookup (if applicable):
mapbox
I'm not sure I understand this issue. Some of the results returned by Geocoder have omitted: true and some don't. Are you saying Geocoder should be handling these results differently?
@alexreisner if the first result is ommited is ignored, the second one is used.
I'd like a way to override this behaviour. To use the first value even if it's ommited
Hmm, I think I need more context. Can you share some code that shows the result being ignored?
I took a quick look at this one and from what I can tell this is a Mapbox specific property of a response object -- geometry.omitted is documented in the Mapbox API docs as `"If present, indicates an out-of-parity match. This occurs when an interpolated address is not in the expected range for the indicated side of the street."
However, I was unable to find anywhere in the Geocode source any code that specifically handles this field. And there doesn't seem like there's a parameter that can be passed when doing a search on the Mapbox side either.
Running the provided query, I got this:
>> Geocoder.search("Rua Egas Moniz 8, 1900-218, Lisboa").map { |e| [e.data["id"], e.data["geometry"]["omitted"]] }
=>
[["address.6927141432861488", true],
["address.5841805573833482", nil],
["address.2772137818844302", nil],
["address.861259087495360", nil],
["address.8720438474604374", true]]
What this tells me is that perhaps the reported problem exists downstream in application or third party code? Because it doesn't look like Geocoder does anything at all with this state one way or another.
Since the data comes through unfiltered, it can be post processed still... with something like a select or reject call on data["geometry"]["omitted"].
Just adding this note in case it helps.