inaturalist / iNaturalistReactNative

Cross-platform version of the iNat mobile app
MIT License
63 stars 21 forks source link

Cameras do not wait for best location accuracy #1340

Closed kueda closed 3 months ago

kueda commented 5 months ago

Describe the bug The cameras do not wait for most accurate coordinates like ObsEdit does, so the new suggestions-first flow results in observations with inaccurate and imprecise coordinates.

To Reproduce

This is hard to reproduce under development conditions because you need to be moving around so your coordinates are always changing, and you need to be using the app intermittently so it occasionally has stale coordinates or tries to fetch cell-based coordinates. Try actually using the app in the field for a few hours and then looking at your coordinates to see if they seem accurate. Make sure you don't have a GPS tracking app on or anything else that would keep your phone's location cache fresh.

Expected behavior Cameras should continue fetching coordinates until the horizontal positional accuracy falls below 10 m, just like ObsEdit does when you start an obs w/o evidence.

Context (please complete the following information): Reported by @loarie w/o device or OS specifics.

Additional context I'm taking some liberties with my diagnosis. This was Scott's actual report:

I enjoyed taking v0.29.0 (81) for a test this weekend https://www.inaturalist.org/observations?d1=2024-03-31&place_id=any&subview=map&user_id=loarie&verifiable=any I was getting some inaccurate (locations and location precisions)

But I noticed this problem myself when testing last week and I suspect my diagnosis explains Scott's problems. The cameras fetch location as of #1294, but they only fetch it once, which means the app is likely to get stale coordinates from the operating system that are almost always imprecise and often inaccurate to boot, e.g. https://www.inaturalist.org/observations/204804743 (Scott was almost certainly on Ring Mountain, not in a nearby suburban neighborhood). This is opposed to ObsEdit, where coordinates are fetched continuously until they fall below an uncertainty threshold.

IMO, there are two approaches

  1. Fetch coordinates continuously in the cameras and pass that through to Suggestions and ObsEdit like we're currently doing; a user will usually spend enough time in the camera to get reasonably precise and accurate coordinates
  2. Fetch quick coordinates in the camera that are only used on Suggestions and allow ObsEdit to fetch continuous coordinates when the user lands there

The first approach could fail if the user doesn't spend enough time in the camera to get good coordinates, but I suspect that doesn't happen very often. The second will fail in situations where people leave the app in the camera or on Suggestions, and only continue the observation process later when they're in a different location. I personally do that from time to time and I suspect that's a more frequent phenomenon than taking a picture very quickly in the camera.

loarie commented 5 months ago

Device: iPhone iPhone 13 Pro OS: iOS 17.3.1

kueda commented 4 months ago

Talked about this today w/ Abhas and we want to with option 1: continuously fetch location in the cameras until accuracy drops below 10 m, and otherwise don't change the behavior of ObsEdit.

kueda commented 3 months ago

FWIW, I ended up kind of combining approaches 1 and 2: the cameras will fetch location continuously, but ObsEdit will also do that if the accuracy recorded by the camera is above the threshold. This also gets around the problem of asking for location permission after we would usually be fetching location in the camera: even if the user seems some sub-par suggestions, ObsEdit will fetch good coordinates if the user granted location permission.