Closed paul121 closed 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:
farm_asset
page View: https://github.com/farmOS/farmOS/blob/04bf771d91cde8276b67090d2b97c4e4558332b9/modules/core/ui/map/farm_ui_map.views_execution.inc#L99asset_type_layers
behavior, which calls results in addClusterLayer()
(below) to be called in farmOS-map: https://github.com/farmOS/farmOS/blob/6cca1b15afec25de05e3b36e3c1cf77933546bac/modules/core/ui/map/js/farmOS.map.behaviors.asset_type_layers.js#L45farmOS-map:
addClusterLayer()
function for adding a cluster layer: https://github.com/farmOS/farmOS-map/blob/d3fcfc6790309775f4d242c5682822aff159eb07/src/instance/methods/layer.js#L51addClusterLayer()
): https://github.com/farmOS/farmOS-map/blob/d3fcfc6790309775f4d242c5682822aff159eb07/src/styles/index.js#L45I'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.
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.
FYI I just opened this PR to more strongly encourage GEOS for farmOS: https://github.com/farmOS/farmOS/pull/521
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](https://user-images.githubusercontent.com/3116995/161447862-8190025b-4858-4c87-ba06-7df4b0ab01dc.png)