Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign region id has difficulties at the coast line #825

Open
chahank opened this issue Dec 7, 2023 · 5 comments
Open

Assign region id has difficulties at the coast line #825

chahank opened this issue Dec 7, 2023 · 5 comments

Comments

@chahank
Copy link
Member

chahank commented Dec 7, 2023

The method to assign country codes to coordinates, util.coordinates.get_country_code does not work well close to the coastline. This is probably due to the use of cultural boundary maps from Natural Earth. Despite using the 10m resolution maps, coastlines seem rough. This is important because the method does 1. mask out all points not on land 2. assign country ids. Thus, points that are incorrectly set in the water will have the id 0 for water.

This is particularly not surprising, but we might be able to improve upon it. This issue is to document this and allow room for discussion. Maybe one could improve by combining different maps from natural earth (such as coastlines + small islands with boundary lines (countries with sea territory)). Or by using another service if needed (e.g. a google earth API?)

Here are two examples for which the method util.coordinates.get_country_code would assign 0 as country id to the points (i.e., not in country but in water/ocean):

  • Tromso in Norway: 69.6833 N, 18.95 E
Screenshot 2023-12-07 at 10 51 09 Screenshot 2023-12-07 at 10 51 43
  • Suva in Fiji: 18.133 S, 178.433 E
Screenshot 2023-12-07 at 10 53 18 Screenshot 2023-12-07 at 10 53 00
@peanutfun
Copy link
Member

Thanks for the thorough report! It seems like the Natural Earth data resolution is too coarse for this kind of application.

By the way, I just realized that "10m" does not stand for "10 meters" but a 1:10 million map resolution. Not sure if I was the only one who assumed that 😅 The Natural Earth website states "Show the world on a large wall poster." for the 1:10m resolution. If I understand correctly, these maps are really meant for showing large-scale, global features. I might make sense to look for another data provider when determining the "on land" property of coordinates, as you suggest.

@chahank
Copy link
Member Author

chahank commented Dec 8, 2023

Oh, thanks, that makes so much more sense!

@peanutfun
Copy link
Member

The ArcGIS World Countries feature layer might be a useful source. But the arcgis Python plugin is not available for osx-arm64 platforms (yet?)

@spjuhel
Copy link
Collaborator

spjuhel commented Apr 18, 2024

Could this https://github.com/thampiman/reverse-geocoder be useful?

@chahank
Copy link
Member Author

chahank commented Apr 18, 2024

That looks indeed very nice! And only two dependencies that we already have. However, it is unclear whether it remains maintained or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants