i-rocky/country-list-js

Neighbours

ekkis opened this issue · 1 comments

ekkis commented

one thing that would be really useful is to be able to return neighbours of a country. I'm thinking about something like:

console.log(country.getNeighbours('US');)

to get:

['CA', 'MX', 'RU']

so maybe, down the line, when we have political subdivisions (I'll create a new issue for that), then we would extend the concept to it

I'm not sure I can spend a lot of time with it right now so if you're up for it, please feel free, but at least we have an issue for it and I can come back to it

and neighbours maybe could be segmented into contiguous neighbours and discontiguous, which would allow relationships with islands. so the US could be a neighbour of Jamaica. not sure that works all that well. perhaps, since we have regions now we could create neighbours for regions i.e. the Caribbean is a neighbour of North America

ekkis commented

tried GPT but it doesn't have the data, however, I found this: https://github.com/geodatasource/country-borders/blob/master/GEODATASOURCE-COUNTRY-BORDERS.CSV