gbif / hp-beaty-biodiversity-museum

This repository is for the GBIF Hosted Portal for the Beaty Biodiversity Museum
https://collections.beatymuseum.ubc.ca
Apache License 2.0
0 stars 3 forks source link

Search filter for records with geo-coordinate without country coordinate mismatch not formatted correctly #65

Closed mpitblado closed 7 months ago

mpitblado commented 7 months ago

Related to #57 and #58

Currently the statistic for "Georeferenced Records" makes the call to https://api.gbif.org/v1/occurrence/search?institutionCode=BBM&hasCoordinate=true&hasGeospatialIssue=false. This is the correct format for the api.

For the search filters, however, hasCoordinate=true&hasGeospatialIssue=false is not the correct syntax. Based on https://github.com/gbif/gbif-web/blob/master/packages/react-components/src/search/OccurrenceSearch/config/filterConf.js there is no filter for georeferenced coordinates only, however the ?view=MAP parameter will take the user to where we want them to go and inherently apply the filter.

Filtering out points on the map that have an occurrence issue appears difficult however. To search for records with the issue, we could use issue=COUNTRY_COORDINATE_MISMATCH&view=MAP however searching for records without the issue leads to ?filter=eyJtdXN0X25vdCI6eyJvY2N1cnJlbmNlSXNzdWUiOlsiQ09VTlRSWV9DT09SRElOQVRFX01JU01BVENIIl19fQ%3D%3D&view=MAP. This filter does appear to be consistant and not random (based on copying the url into a private browsing session and reproducing), and so therefore may be able to be used to replace the url that the statistic links to at some later point in time.

For now, I am going to remove the GeospatialIssue filter from the api call and direct the link to ?view=MAP. This should make the statistic align with the value presented in the top left corner of the map view.

MortenHofft commented 7 months ago

eyJtdXN0X25vdCI6eyJvY2N1cnJlbmNlSXNzdWUiOlsiQ09VTlRSWV9DT09SRElOQVRFX01JU01BVENIIl19fQ%3D%3D is not random.

atob(decodeURIComponent('eyJtdXN0X25vdCI6eyJvY2N1cnJlbmNlSXNzdWUiOlsiQ09VTlRSWV9DT09SRElOQVRFX01JU01BVENIIl19fQ%3D%3D'))
= '{"must_not":{"occurrenceIssue":["COUNTRY_COORDINATE_MISMATCH"]}}'

We just do not have a simple search param for negations and existence.

As for hasCoordinate=true&hasGeospatialIssue=false I never got around to it.