kinotto / geonames.js

Nodejs and Browser client for Geonames.org REST API :earth_africa:
http://www.geonames.org/export/client-libraries.html
MIT License
88 stars 17 forks source link

Duplicate Countries #12

Closed Arlind-Prosperoware closed 5 years ago

Arlind-Prosperoware commented 5 years ago

When using the api to get all the countries const countries = await geoNames.countryInfo({}) //get continents

I'm getting duplicate countries

kinotto commented 5 years ago

Hello @Arlind-Prosperoware the rest api is this one,

http://api.geonames.org/countryInfoJSON?formatted=true&lang=en&username=${YOUR_USERNAME}&style=full

replace ${YOUR_USERNAME} with your username, you will get the json response. If something is wrong in the payload you should contact geonames directly, they have a dedicated forum here: http://forum.geonames.org/

Arlind-Prosperoware commented 5 years ago

Hi @kinotto , The issue seems to be resolved now. There are no more duplicate countries. Thanks.

kinotto commented 5 years ago

great @Arlind-Prosperoware :)

Arlind-Prosperoware commented 4 years ago

Hello @kinotto ,

When I'm using the example code to get all the countries this is the REST API that is being invoked: https://secure.geonames.org/countryInfoJSON?username=prosperoware&lang=en and this API is returning duplicates.

The API that you mentioned is returning the correct format but its not the API thats being called by the code.

kinotto commented 4 years ago

Hi @Arlind-Prosperoware , are you using the commercial tier? did you pass a token in the config object? try to avoid passing the token and see if you still get duplicates.

Anyways if you get duplicates you might ask directly in the geonames forum probably they can better address the problem and probably solve it :)

Arlind-Prosperoware commented 4 years ago

Im not sending the token at all and I'm not using the commercial tier. This is my config: {username: name, lan:'en', encoding:'JSON'}

https://secure.geonames.org/countryInfoJSON?username=username&lang=en This API request is returning duplicates and is not returning all the data.

http://api.geonames.org/countryInfoJSON?formatted=true&lang=en&username=username&style=full This API request is returning the correct data without duplicates

kinotto commented 4 years ago

As i told you the payload of the response is not under my control, and i cannot filter the data in the library cause it wouldn't be the correct solution the purpose of this library is just to wrap their service into a js module. When you say duplicates i don't know at which countries you're referring to because i cannot find them, but a part from that if there is a bug in the service it is correct to raise it in order to make them fix it :)