Observations map doesn't reliably zoom to place so markers can be seen

Platform (Android, iOS, Website):


Browser, if a website issue (Firefox, Chrome, etc) :

Reproduced both on Chrome 108 and Firefox 108.

URLs (aka web addresses) of any relevant observations or pages:


Screenshots of what you are seeing (instructions for taking a screenshot on computers and mobile devices: https://www.take-a-screenshot.org/):

As seen in the screenshots of Chrome below, the issue occurs even when not logged in and the browser has no extensions loaded (i.e. Guest profile used), though I originally encountered the issue on Firefox while logged in, and with my usual extensions loaded.

An example failure:

Example of expected view after zoom:

Description of problem (please provide a set of steps we can use to replicate the issue, and make as many as you need.):

Occasionally, when opening a page of observations of a taxon with a place filter, the map does not zoom in on the place, but remains at the widest view, i.e. of the whole world. Refreshing the page sometimes resolves the issue.

Step 1:

Open a page of observations for a place. The map may or may or may not successfully pan to the place and zoom so that the place’s observations can actually be seen as markers on the map.

Step 2:

If the zoom was successful, try refreshing the page a number of times until it finally fails. I have run test trials where it reliably failed several times in a row, and other trials where it didn’t fail until several retries later, and others when I couldn’t get it to fail at all. It seems to be very timing-sensitive.


Can confirm it happens pretty often with boundaries search.

sounds like:

1 Like

Yes. The first was missed in my search because it’s not in bug reports. The second, I missed because I was looking for issues involving the zoom, not “empty” which wasn’t the symptom I was noticing.

I’ve been having this happen more and more often recently, and not even with a search that’s limited by boundaries.

I played with the Eulophia graminea for North America search (from the “empty explore map” bug report pisum linked above) and refreshed a number of times. Sometimes the map was blanked, and sometimes the map had markers, and was zoomed, but the pan either wasn’t executed, or only partially executed.

Here’s what it seems like is happening:

  • if all of the steps are executed in time, the display is fine
  • if none of the steps are executed in time, the display is empty and the map is at the default zoom level (whole world)
  • or it could just get partway through before the timer expires (i.e. the zoom / incomplete pan case)

My guess is that some part of rendering the map is only given a fixed amount of time to execute via one of the setTimeout() calls in https://github.com/inaturalist/inaturalist/blob/main/app/assets/javascripts/ang/controllers/observation_search.js.erb … but which, I can’t say. Then if that fails, there is no subsequent event fired to do the steps that were missed at the start.


take a look at the first link in my post above. i think that roughly explains this case.

i haven’t looked at the code, but it looks to me like the map is getting shifted to the left slightly to account for the space occupied by the floating list of observations. that floating list will occupy a different position on the map, depending on how wide the map is. so i think what’s happening is if the position of that list is not properly determined prior to the zoom to bounds action of the map, then it shifts left based on some default value. but if the position of the list is determined properly prior to the zoom to bounds, then the zoom to bounds action can be followed up by a shift based on the actual size and position of the observation list.

1 Like

Would you expect it to shift different amounts refreshing the same URL over and over? That’s what I’m observing. If I can reproduce it, I’ll post some screenshots.

@benarmstrong I think you’d be able to write a much more coherent Github issues for this than I could - would you be able to do that?

1 Like

Sure! Done: https://github.com/inaturalist/inaturalist/issues/3636