Changing map layer style breaks layer
Expected Behavior
After changing a layers style in a map, I can click the Layer Settings button and under the Style setting switch between the new style and another style.
Actual Behavior
When clicking the Layer setting button it either instantly fails or the panel opens and when selecting the Style settings dropdown I get this error
Steps to Reproduce the Problem
- Add a layer to a map
- Change the layers style and click Apply
- At this point it works as i would think and can use the Layer settings > Style settings panel to toggle between styles.
- Change the style again
- Save the map and close
- Open map
- Click Layer settings for the layer
Specifications
- GeoNode version: master
- Installation type (vanilla, geonode-project): geonode-project
- Installation method (manual, docker): docker
- Platform: ubuntu 20
- Additional details: Experienced the same behavior on the demo site
If I remove the styles array from the maps_layer extra params column I am able to get the layer to work again
{ "msId": "9a4e93cb-296e-4086-a18c-9cd5519eacbb", "styles": [ { "name": "geonode:e3a7d800-ace9-11ef-bdfa-259dc132ae4c_ms_airports", "title": "airports", "format": "sld" } ] }
The console log TypeError: Cannot read properties of undefined (reading 'LAYER') at visual-style-editor-…ea.chunk.js:1:28531
I do not see any network calls before the error comes up.
@jeff-bradley can you prepare a reproducible setup either on the stable or dev GeoNode demos?
@giohappy here is a test map on the development site. once I click style settings I get an error https://development.demo.geonode.org/catalogue/#/map/1652
I have the same problem with a 404 in geoserver logs like :
24 Oct 11:16:10 ERROR [geoserver.rest] - No such style: my_beautiful_layer_20231211
org.geoserver.rest.ResourceNotFoundException 404 NOT_FOUND: No such style: my_beautiful_layer_20231211
Whereas the style exists.
Btw I think it is not the same issue, it is about uploading an SLD in v1.1.0. Did you upload an SLD before ? If you try with more logs you will see an error during uploading sld 1.1.0 you will see:
celery | File "/usr/local/lib/python3.10/dist-packages/geoserver/style.py", line 34, in __init__
celery | assert style_format in Style.supported_formats
celery | AssertionError
Error about SLD in 1.1.0 version is also reported using the rest api here below: https://github.com/eblondel/geosapi/issues/29
SLD 1.1.0 is still not supported: https://github.com/GeoNode/geoserver-restconfig/blob/master/src/geoserver/style.py#L24-L28
I can see the original issue has been resolved by what I think is part of the mapstore client integration. The new settings panel works a lot better, as I do not see the issue if the layer has multiple styles (the image has a second style created in geoserver not geonode)
Not sure if need to open a new issue if I cant seem to create the second style in geonode to have it show up under the style selection list. For example when changing a style layers style in a map it works with no issue but after clicking the layer settings and going to the style tab only the original style exists and when selecting this it does change the style but i am unable to return to the other style just created.