gbif / portal-feedback

User feedback for the GBIF API, website and published data. You can ask questions here. 🗨❓
30 stars 16 forks source link

Endpoint for geojson of GBIF definition of country and area boundaries #1275

Open MortenHofft opened 6 years ago

MortenHofft commented 6 years ago

The website is using a geoJson found somewhere online of countries. The API has its own definition of names, country borders etc. It would be nice to align those by having an API endpoint that exposed whatever GBIF currently is using when interpreting records.

Without it the two are bound to drift and any charts using maps will be wrong.

@MattBlissett you have been updating map boundaries and names in the past - you must have an idea of what it would take.

rukayaj commented 3 years ago

@MortenHofft @MattBlissett we've just had an error reported in one of the country boundaries. This point https://www.gbif.org/occurrence/1702169082 is highlighted as having a country-coordinate mismatch error, but actually the country is correct. Interestingly, google maps makes the same error: https://goo.gl/maps/EjsrdxJes18D27Ux whereas open street maps does not https://nominatim.openstreetmap.org/ui/search.html?q=59.6997%2C11.9452

Might be worth not applying this error highlight if a point falls very close to a border if one of the two countries is correct? Or otherwise I guess finding an updated Norway-Sweden border somewhere. Shall I make a separate issue for this?

MortenHofft commented 3 years ago

This issue I left is very vague and hard to read for anyone 2 years later, but I believe what I referred to was the network page https://www.gbif.org/the-gbif-network On that page we have a map showing country borders. The participation map we call it. But that map is generated using a geojson that is years old and it might never have aligned with how we else define country borders.

MattBlissett commented 3 years ago

We use polygons from Natural Earth (for geocoding) and Natural Earth + OpenStreetMap (for display on occurrence maps).

SELECT iso_a2, ST_AsGeoJSON(ST_SimplifyPreserveTopology(ST_Union(geom), 0.01), 2) FROM political GROUP BY iso_a2; on the prod_eez database will get features for a ~3MB GeoJSON. I don't know what's realistic for this map — the 0.01 is the simplification tolerance, and the 2 is the number of decimals in the coordinates.

Result: https://gist.github.com/MattBlissett/649edf9b42dddb0cfef511eb4769c343

MortenHofft commented 3 years ago

Thanks Currently the website use a 637kb topojson https://www.gbif.org/api/topojson/world/participants

We can do a simplification of what you send to begin with, but down the line it might be nice if we exposed country, gadm, marine? layers as vector tiles. That would allow for a high resolution network map. And it would open up options for choropleths on e.g. occurrence search.