I don’t want landmark and water to be selected from the options in areas. how can I do that?
I want the option of landmark and water not to be selected when the menu first comes up.
I don’t want landmark and water to be selected from the options in areas. how can I do that?
I want the option of landmark and water not to be selected when the menu first comes up.
There isn’t an easy way to do that right now, but I can point you to where those layers are added in code and maybe you can dig into the code and figure something out…
That JS behavior is responsible for adding each area type as a layer on the map. It calls the instance.addLayer()
method provided by farmOS-map.js (see GitHub - farmOS/farmOS-map: farmOS Map is an OpenLayers map designed for farmOS and farmOS Field Kit. It can be used in any project that has similar requirements.), which in turn calls the OpenLayers map.addlayer()
function (see OpenLayers v6.5.0 API - Class: Map), to add a new vector layer. This new vector layer is built here: farmOS-map/layer.js at 1bb8346e8948eab3656ea19102ccdcc6026f5959 · farmOS/farmOS-map · GitHub
You’ll notice that there is a visible
option in that function which defaults to true
. I believe if you add visible: false,
right below this line in farmOS, it will uncheck the boxes. Then you just need to add some conditional logic to only uncheck the ones you want.
Of course, this is not a good long-term approach, because it requires hacking farmOS core. So you’ll need to be careful that you don’t lose those changes when you update farmOS (which overwrites any changes to core).
Hope that helps!
When I do visible:false, the map is not loaded in the first opening, but if I check it, the map comes
I think it should be visible:true when loading the map for the first time.
I guess it should always be visible:true at first upload