tomayac / local-reverse-geocoder

Local reverse geocoder for Node.js based on GeoNames data
Apache License 2.0
190 stars 58 forks source link

admin1Code, admin2Code are returned as string instead of object in API response #86

Open shivamsaxenadev opened 3 months ago

shivamsaxenadev commented 3 months ago

Hi Thomas,

Thank you for building this extremely useful application! We have been using it in our app for a few months now, and the results have been accurate 99% of the time.

I noticed that in some cases, the admin1Code or admin2Code returns a string instead of an object. Is this expected behaviour? Here are the requests to reproduce the issue:

curl --location 'http://SERVER_URL/geocode?latitude=-16.48679&longitude=-151.74102'

curl --location 'http://SERVER_URL/geocode?latitude=52.51667&longitude=13.36667'

Please let me know if you need any other information.

tomayac commented 3 months ago

Could you verify if this is a problem in the downloaded GeoNames raw data? The app mostly just reflects what it finds there, without much processing if I recall correctly.

shivamsaxenadev commented 3 months ago

Hi Thomas, thank you for your response. I appreciate your input on this matter. Unfortunately, I do not have the bandwidth to investigate this further at the moment. However, since this is not currently blocking my progress, I will aim to revisit it when I have more time available in the future.

riccardoratta commented 2 months ago

It seems to be related to use use of the option countries: [...] in the initialisation.

When I select a specific country, e.g., "IT" only a string is returned for adminNcode while if there are no countries it works as expected.