gbif / maps

GBIF mapping service built on HBase and ElasticSearch, supporting Mapbox Vector Tiles and PNGs
Apache License 2.0
48 stars 16 forks source link

taxonKey does not include synonyms #86

Open thomasstjerne opened 1 month ago

thomasstjerne commented 1 month ago

When querying our occurrence search by taxonKey, synonym taxa are included. Example: https://api.gbif.org/v1/occurrence/search?taxonKey=11704916 This gives 66 results, including 40 from Denmark from the Biowide dataset. However, the map does not show any occurrences from Denmark: https://www.gbif.org/species/11704916 And capabilities return only 10 occurrences: https://api.gbif.org/v2/map/occurrence/density/capabilities.json?taxonKey=11704916

I suspect the reason is, that the Biowide dataset uses a synonym (https://www.gbif.org/species/9691027) of https://www.gbif.org/species/11704916.

In order to produce reliable taxon distribution maps, I think this should be aligned with the occurrence search and include occurrence data from synonym taxa.

ahakanzn commented 3 weeks ago

@mdoering Hi Markus, could have a look at this one?

MattBlissett commented 3 weeks ago

This is probably one for @timrobertson100 or me to look at.

Just changing to use acceptedTaxonKey instead of taxonKey would (I think) remove the points from the synonym taxon's map.

timrobertson100 commented 3 weeks ago

This problem is specific to taxa that are at sub-generic ranks and their synonymy.

If you take the canonical Puma concolor example and set the year sliders on the map to be 1943-1943, and the same on the synonym Felis concolor you will find this record appears on both. This demonstrates the species / subspecies level is working as @thomasstjerne expected.

The reason this works is because we hold pointers to the major Linnean ranks (Kingdom, Phylum... Genus, Species) on all records and they are used in the maps here, and in small maps here and large maps here.

I believe adding acceptedTaxonKey to those 3 places will solve this problem bringing consistency to the intermediate ranks - @MattBlissett, can you please follow that and confirm my thinking?

mdoering commented 3 weeks ago

Example: https://api.gbif.org/v1/occurrence/search?taxonKey=11704916

@thomasstjerne a different thing. But the occurrence record has a weird taxon property that should probably not be there:

"genericName":"SH1003366.09FU"

Something in pipelines probably adds this wrongly. The taxon itself does not have that: https://api.gbif.org/v1/species/11704916

mdoering commented 3 weeks ago

The reason this works is because we hold pointers to the major Linnean ranks (Kingdom, Phylum... Genus, Species) on all records and they are used in the maps here, and in small maps here and large maps here.

@djtfmartin this will be another problem to solve with the new taxonomy having unlimited ranks. And unranked can even exist multiple times.