Closed nimmolo closed 3 months ago
Ok - I've updated the PR to calculate a consistent area when trying to determine if a location is small enough to be considered "not vague". It uses the proper formula for the area of a spherical patch, converting degrees to radians.
area = Rˆ2 (Θ1 - Θ2) (sin(ɸ1) - sin(ɸ2))
That's right, Mr. Towell, I remembered that! (Just kidding, no i didn't!)
My arbitrary area cutoff now is 24,000 sq. km. This includes the box around "Peace River Area" but excludes the box around "Denali National Park". (Note that the box around a location may be a much larger area than the location itself.)
localhost:3000/names/5066/map
Doubling the cutoff to 48,000 sq. km would include the box around "Denali", but also probably the box around "Massachusetts" and a bunch of other vague locations. Please feel free to help me decide what the max should be!
I feel like our stance at a certain point has to be, "if you want this observation to appear on maps, then please give a more precise location". There's another discussion about warning people that an observation's location is not precise enough.
Thanks for thinking this through and doing the PR.
Added the following message to show obs, under the location, if the location is vague:
This observation will not appear on maps of its taxon because the location is too vague.
If the current user is the observation owner, it also says this:
If you would like it to be included in maps, choose a more precise location.
Also added a test that these messages appear if appropriate.
Cleans up maps by getting rid of overly vague location boxes
Currently on the site, we exclude observations whose location is "Earth" on maps, because they mess up the interface. But an observation with a large associated Location like "USA" also obscures more specific observation data on a map, whenever the vague location gets grouped with the more specific locations. (See discussion #2088.)
One way to fix this might be by grouping large locations together so they don't hide the precise ones. But it's hard to control the order of grouping (it would require calculating each location's surface area from lat/lng) and ordering by this derived value. But big boxes would still make underlying boxes difficult to click.
@pellaea proposed just excluding all big locations from mapsets, because
First try: 1º lat/lng max box size
I tried excluding locations whose east-west longitude difference, or north-south latitude difference, was more than 1º either direction, and it immediately improved the legibility of the test map I used for debugging, "observations of name 5066".
Before:![Screen Shot 2024-04-10 at 4 34 54 PM](https://github.com/MushroomObserver/mushroom-observer/assets/1948095/5bcf23c1-b77e-4c30-aa00-fc24735972a8)
mushroomobserver.org/names/5066/map
After:![Screen Shot 2024-04-10 at 4 33 36 PM](https://github.com/MushroomObserver/mushroom-observer/assets/1948095/591d4507-cfc6-4d95-bfdb-a58296c49156)
localhost:3000/names/5066/map
However, 1º is not the same everywhere on the globe. Using a "1º rule" obscures some locations closer to the poles that may be considered marginally useful.
For example, observations at Denali National Park and Peace River Area currently appear on the live site:
mushroomobserver.org/names/5066/map
But when limiting areas to "1º" in either direction on this branch, the observations at these locations are not shown:
localhost:3000/names/5066/map
I'm going to search for a better formula for areas of these boxes so we're doing orange-to-orange comparisons of geometric area.