farmOS / farmOS-map

farmOS-map is an OpenLayers wrapper library designed for agricultural mapping needs. It can be used in any project that has similar requirements.
https://farmOS.github.io/farmOS-map
MIT License
35 stars 21 forks source link

Inconsistency with cluster count location #157

Closed paul121 closed 2 years ago

paul121 commented 2 years ago

I've experienced this a couple times now. Sometimes when viewing the /assets or /assets/{bundle} view in farmOS ~50% of the clusters are rendered in the wrong location. Refresh the page and the clusters are correct. Refresh again and they are back to the same incorrect spot. It seems like this is purely a JS bug, because the server should be caching this cluster geojson layer and it should not be changing between page reloads.

Attached is a screenshot where all the geometries are located in Washington state, but this is showing half of the clusters being SW down by Florida. I also experienced this with some geometries in SW Australia, the clusters would appear NW of where they should, perhaps (very) roughly the same distance away as this Washington example. Not sure if this is a clue, just an interesting observation... cluster_inconsistency

mstenta commented 2 years ago

Huh - that is odd!

It seems like this is purely a JS bug, because the server should be caching this cluster geojson layer and it should not be changing between page reloads.

I did a quick search in the OpenLayers issue queue and didn't see anything obvious about this (admittedly a very quick search).

farmOS and farmOS-map have very minimal logic for the clusters themselves. Documenting them here for reference:

farmOS:

farmOS-map:

paul121 commented 2 years ago

Screenshot from 2022-04-07 10-01-19

mstenta commented 2 years ago

I'm curious if this happens in the farmOS Docker image. @paul121 said these are happening currently on platform.sh - which might not have BCMath or GEOS installed/enabled.

paul121 commented 2 years ago

Figured this out while on the dev call today. @mstenta is correct, this issue stems from my server not having the PHP GEOS extension! BCMath is enabled by default on platform.sh but I'll need to work on adding GEOS. https://docs.platform.sh/languages/php/extensions.html

Turns out the cluster is consistently rendered in the same spot! The "inconsistency" is that the map will sometimes zoom to the clusters before zooming to the other vectors. When it zooms to the field vectors the errant cluster is out of view.

So no bug in farmOS-map. We could check in on this cluster zooming issue (which is a part of farmOS/farmOS anyways) but normally it won't be an issue since the clusters should be at the same location as all of the geometries.

mstenta commented 2 years ago

FYI I just opened this PR to more strongly encourage GEOS for farmOS: https://github.com/farmOS/farmOS/pull/521