node-geocoder icon indicating copy to clipboard operation
node-geocoder copied to clipboard

Google reverse geocoder only uses the first result

Open Wardormeur opened this issue 6 years ago • 1 comments

Hi :) First of all, thanks for your work on this lib! We've been using Google reverse geocoding for several usage, and we've felt short in a scenario : administrative levels are sometime not being outputted. The reason for that is that when multiple rows are being returned, only one is being used (https://github.com/nchaulet/node-geocoder/blob/master/lib/geocoder/googlegeocoder.js#L298). The issue with that is that for { lat: 53.61748476104803, lon: -2.1537119150161743 } for example, the administrative levels are being set in the following rows, which looks like higher level matches. My solution would be to reduce the address_components and assign them to the single result row before passing it to _formatResult. For anybody, if that's considered a non-issue, you can still retrieve the information from the result.raw, but that becomes a manual parsing.

Wardormeur avatar Feb 13 '19 10:02 Wardormeur

You can try a new library https://github.com/goparrot/geocoder

ruscon avatar Mar 02 '19 10:03 ruscon