gbif / portal-feedback

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

How to map occurrence records from multiple datasets with hexagon symbols? #4385

Closed gbif-portal closed 1 year ago

gbif-portal commented 1 year ago

How to map occurrence records from multiple datasets with hexagon symbols?

I want to generate a map with with 3 whole datasets and use the hexagon density symbols that are the default when looking at the summary for a dataset. I tried a query of Occurrences with my 3 datasets, but there are only two map style options. Is there a way to choose the hexagon style for this map? If not, is there a way to combine datasets when I query the datasets in order to get that map style? I can download all of the records and make my own map in ArcMap but I'd rather use existing resources since they exist.


User: See in registry - Send email System: Chrome 106.0.0 / Windows 10.0.0 Referer: https://www.gbif.org/occurrence/map?dataset_key=06a00852-f764-4fb8-80d4-ca51f0918459&dataset_key=3ca53690-d42a-4b49-9f7d-e247d8eee7a5&dataset_key=52da118d-e74e-420a-9b6b-1a6d7bc3028d&institution_code=UMNH&taxon_key=44&occurrence_status=present Window size: width 1920 - height 937 API log&_a=(columns:!(_source),filters:!(),index:'3390a910-fcda-11ea-a9ab-4375f2a9d11c',interval:auto,query:(language:kuery,query:''),sort:!())) Site log&_a=(columns:!(_source),filters:!(),index:'5c73f360-fce3-11ea-a9ab-4375f2a9d11c',interval:auto,query:(language:kuery,query:''),sort:!())) System health at time of feedback: OPERATIONAL

MattBlissett commented 1 year ago

The dataset (and country, taxon, publisher) maps are produced differently to the general query map. To keep the general query map fast and reliable, the data are shown at a much lower resolution.

It is possible to generate hexagons from the general query map, but they would need to be fairly large.

I produced this map using the debug interface: https://api.gbif.org/v2/map/debug/ol/

  1. Set data source to Ad-hoc search
  2. Set binning to hexagons, and adjust the slider so the hexagons are large enough that there are no gaps (to cope with the reduced resolution of the ad-hoc search)
  3. Paste dataset_key=06a00852-f764-4fb8-80d4-ca51f0918459&dataset_key=3ca53690-d42a-4b49-9f7d-e247d8eee7a5&dataset_key=52da118d-e74e-420a-9b6b-1a6d7bc3028d&institution_code=UMNH&taxon_key=44&occurrence_status=present into the map key box. (The query is from the URL of your search.)

That gives URL templates of https://tile.gbif.org/4326/omt/{z}/{x}/{y}@2x.png?style=gbif-classic and ../../../map/occurrence/adhoc/{z}/{x}/{y}@2x.png?srs=EPSG:4326&bin=hex&hexPerTile=15&dataset_key=52da118d-e74e-420a-9b6b-1a6d7bc3028d&institution_code=UMNH&taxon_key=44&occurrence_status=present&style=classic.poly, the latter being https://api.gbif.org/v2/map/occurrence/adhoc/{z}/{x}/{y}@2x.png?srs=EPSG:4326&bin=hex&hexPerTile=15&dataset_key=52da118d-e74e-420a-9b6b-1a6d7bc3028d&institution_code=UMNH&taxon_key=44&occurrence_status=present&style=classic.poly. They can probably be used somehow in ArcMap, or appropriate images downloaded and overlayed/joined in any graphics editor.

Edit: this doesn't work, the debug interface ignores the repeated datasetKey values. Add them in afterwards: https://api.gbif.org/v2/map/occurrence/adhoc/{z}/{x}/{y}@2x.png?srs=EPSG:4326&bin=hex&hexPerTile=15&dataset_key=06a00852-f764-4fb8-80d4-ca51f0918459&dataset_key=3ca53690-d42a-4b49-9f7d-e247d8eee7a5&dataset_key=52da118d-e74e-420a-9b6b-1a6d7bc3028d&institution_code=UMNH&taxon_key=44&occurrence_status=present&style=classic.poly

I can't show the background image in a GitHub comment, but here is the occurrence data at zoom 0:

And the background:

To make a map of this query with small hexagons isn't possible with API queries alone. Some other tool would need to query the API for the data, then summarize it. (ArcMap, R, Python etc.)

MattBlissett commented 1 year ago

(User not informed by email, in case helpdesk want to add anything first.)

CecSve commented 1 year ago

Thanks @MattBlissett - I'll reply on behalf of helpdesk and include your walkthrough!

kderieg322079 commented 1 year ago

Hi GBIF folks. I'm the user who submitted this ticket. Hope it is okay for me to reply here on GitHub. Thanks so much for this tutorial; this is a huge help and gives me something to go off of. Looks like for what I want, I'll just have to download data and make a map with ArcMap. Just figured it was worth asking if I could use the existing tools on GBIF. But this is still super great info to have going forward using GBIF, so thanks again.

ManonGros commented 1 year ago

Thanks for replying @kderieg322079 you are very welcome to reply on GitHub. I assume we answered your question so I will be closing the issue now. Don't hesitate to contact us again if you need anything else.