[API-users] interaction for the maps api
kenichi.ueda at gmail.com
Mon Mar 16 22:30:35 CET 2015
We just added GBIF tiles as an optional overlay to many of our maps at
great and the API works perfectly, but the first thing people want to
do when they see this data is click on those points! Has anyone at
GBIF or elsewhere given some thought to how to implement that?
The easiest way to do this from our perspective would be for GBIF to
implement a UTFGrid endpoint for their tiles
(https://github.com/mapbox/utfgrid-spec). The corresponding JSON
wouldn't have to include all the occurrences (which would probably be
a lot) but it could include 1 page of occurrences, or just a bounding
box clients could use to generate a link to retrieve the corresponding
data on GBIF.
Another method I was thinking about was to make a custom tile overlay
composed of HTML canvas elements, load the tile image onto the canvas,
and use clicks to get the RGBA values of the corresponding pixel at
the click coordinates to see if there was any color there. If alpha ==
1, then retrieve corresponding occurrences from the GBIF occurrences
API using the bounding box implied by the pixel at that zoom level.
Canvases have been used as overlays in Google Maps, at least (e.g.
https://github.com/brendankenny/CanvasLayer), and I'm sure in other
frontend map frameworks as well, but I'm not sure what the performance
would be like.
More information about the API-users