Closed ChunPangWong closed 4 years ago
I noticed the same thing and apparently it's because the Web Service call to google to fetch nearby places (post geocoding auto complete search location) is done on a radius and is not ranked by distance; hence, google returns (by default) prominent results and not places which are close by.
As @bhutanigautam indicated, the results displayed are as per what the call to nearby places API returns. I observed that myself, so I tried to ignore the first item in the result, but then in some situations the first item was relevant.
I think normal users may be able to overlook these.
Hey @blackmann , I was playing around with the code yesterday - check this out -
In search type in - Maharaja India, Santa Marta
and select the location from the drop down. This assumes that I want to use that location.
Post the selection, the code geocodes and selects the first result and then shows the nearby places - this has two issues -
Maharaja India
and the code sets the name
to road; hence, we lose the selected place from auto-complete.Maharaja India
as it's not ranked by distance, hence, we lose the selected place there as well.That is, there is no way for me to select the location which I searched for.
Now, I recommend that -
Let me know what you think and I can raise a PR.
Hi @bhutanigautam, great work
Geocoding result should only be used to search for near by places and not to set the locationResult
I do not understand what exactly you mean, but contemplating more, i think geocoding should only be done when the user taps a location on the map. that would make sense or when a custom start location is set.
And I agree with everything else you said.
You can go ahead with the PR, let's have it reviewed and do good.
Thanks for the insight.
Hey, will raise one over the weekend.
What I meant is -
The problem with this is that you try to take care of two separate use cases in one go - user clicking on the map AND user selecting an auto complete result.
User clicking on the map - yup, we need it there. User selecting an auto complete result - we don't need this logic here becasue the user has already selected the location she wants; hence, we already have the place details. Why set it again?
Yeah, that's right.
Hey, there are no tests!? I can't use this in prod without this being stable and/or having a governance model. Sorry bud, I don't have the time to add tests to this project.
I search the "4021 Morgan Street, Little Neck, NY, USA" , But the first nearby places is "41-35, Morgan St" 。