Random color style problems with heatmap tiles delivered (related to caching?)

There seem to be random style problems with the heatmap tiles delivered by the iNaturalist API (in both versions v1 and v2). It looks like maybe cached tiles are returned without regard to the color parameter. so if the color parameter has been used before to generate tiles, then it’s possible those colored tiles maybe returned from cache even if color is not specified in subsequent requests (and vice versa).

First, I noticed that they seem to be occasionally generating as if I had passed color=red as a parameter, even when I had not passed a color parameter. For example:

Also, I noticed that when I do explicitly pass a color parameter, the tiles often generate as if I had not passed a color parameter. For example:

When I use iNat’s own map that generates heatmaps when project_id is passed, I’m seeing no issues. For example, this is https://www.inaturalist.org/observations/map?project_id=37020#4/5.617/15.88 :

It looks like the iNat map uses v2 and passes in extra parameters style=geotilegrid&tile_size=512, but when I pass those to the API v2 in my own map, I’m still seeing occasional unexpected results:

The problems occur when I just get individual tiles, too, but I showed examples from my custom map just because that allows me to fetch more tiles at once in an easily configurable way and is also where I first noticed the problem. I even tried this in ArcGIS Online, and I see cases there where I don’t specify color, but it still gives me some tiles as if I had passed color=red and some tiles as if I had passed color=blue. So I don’t think the problem is related to my custom map page.

Finally, I noticed that the iNat map is using tiles.inaturalist.org instead of api.inaturalist.org, and when I switch to tiles.inaturalist.org, that seemed to address the random style issues. But I think that was only because no one had used colors on that subdomain before. when i use colors on tiles.inaturalist.org, that causes the problem to emerge on subsequent requests to tiles.inaturalist.org, and that gets propagated to iNaturalist’s own map:

1 Like