react-native-geocoder icon indicating copy to clipboard operation
react-native-geocoder copied to clipboard

Android: Why fetching 20 addresses?

Open sanjeevraolade opened this issue 7 years ago • 3 comments

image According to API, recommended is 1-5, but in this packager/api was hard - coded as 20. So may not get proper results ...

package API Code: List<Address> addresses = geocoder.getFromLocation(position.getDouble("lat"), position.getDouble("lng"), 20);

It should be like

List<Address> addresses = geocoder.getFromLocation(position.getDouble("lat"), position.getDouble("lng"), 2);

OR

Give an option to user, so user can pass that value. Hope you understood, what i am trying to explain..

sanjeevraolade avatar Aug 21 '18 12:08 sanjeevraolade

Fixed in timwangdev/react-native-geocoder-reborn, now it only fetches 2 results.

timwangdev avatar Nov 27 '18 03:11 timwangdev

@timwangdev Thanks for update. However, If control is given to user (who uses Geo code) to pass the noOfAddress would be a better idea. If nothing is passed you can default to 2 ..

sanjeevraolade avatar Nov 27 '18 09:11 sanjeevraolade

@sanjeevraolade The iOS equivalent method CLGeocoder reverseGeocodeLocation don’t have simliar option to limit results. While in the most use cases only first object in the list would be used, since it is sorted by relevance by default.

Could you share the cases why number of address would be used?

timwangdev avatar Nov 29 '18 03:11 timwangdev