-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with layer style legends displayed when more than one style is selected #7236
Comments
…n one style is selected (#7253) (#7256) Co-authored-by: Alessio Fabiani <[email protected]>
I still see the UUID in the legend title on master: https://master.demo.geonode.org/layers/geonode:background_layer_germany_epsg4326 Is this not yet backported? It should be part of 3.2 in my opionion. |
@gannebamm yes, this is quite problematic. I've spent some time to investigate it. 1 - When the Style Editor sends the first POST (through the geoserver_proxy view), GeoNode triggers the Geoserver post save signal geonode/geonode/geoserver/helpers.py Line 1082 in 190e5f0
This is where the new style is retrieved from Geoserver and saved in GeoNode. NOTE: The style editor POSTs using the 2 - The style information is obtained from the gs_restconfig parsing. Both with CSS and SLD styles it seems that gs_restconfig doesn't populate the geonode/geonode/geoserver/helpers.py Line 1055 in 190e5f0
An example with a CSS style. Code posted by the Style Editor
Output from Geoserver (/geoserver/rest/workspaces/geonode/styles/line_3___2964cfc0-a671-11eb-a607-47c492148453.sld)
gs_restconfig parsed information where the style infor is obtained from/geoserver/rest/workspaces/geonode/styles/circle_2___b450e9a0-a678-11eb-a607-47c492148453.xml:
The same happens with an SLD 3 - In case of an SLD style it tries to parse the sld_title property if available, otherwise the style name is used. In case of a CSS it uses the style name directly geonode/geonode/geoserver/helpers.py Line 1154 in 190e5f0
In both cases the end result is that the style name, the one with the hash, is used and stored. In the end the problem is probably due to the an incomplete metadata information for the style returned by Geoserver REST API. I will ask the Geoserver team if / how the returned metadata can be extended with the title. I guess it's not that strighforwars, since an SLD can be used in library mode, so multiple styles could be stored inside it. Otherwise we need to change the way we obtain style info from Geoserver. |
It's confirmed that the solutions are two: 1 - Obtain the style from Geoserver REST API in SLD format and parse the title from the 2 - Use the style metadata info capacilities. If a PUT to Geoserver style REST API contains a metadata propert, this should be stored along with the style and be returned when requesting the XML for the style. In this case we could make the Style Editor send the title as a metadata info, and simply parse it inside geonode_restconfig (geosolutions-it/MapStore2#3750) We'll discuss the two options internally. |
The mid-term solution will probably be this: GeoNode/geonode-mapstore-client#144 |
This is the short-term solution: #7390 |
@giohappy @afabiani On layers with no default style, multiple legends are displayed. This because the layer_detail template loops through all legends returned by the resource.get_legend |
@marthamareal can you send a PR for this? |
so, in the end, the situation where we have the default style None and multiple legend links is something rare, if not impossible without manually messing inside the DB. |
Fixed through #7405 |
…ore than one style is selected (GeoNode#7253) (GeoNode#7256) Co-authored-by: Alessio Fabiani <[email protected]>
Expected Behavior
When adding more than one style to a layer, I can see the legend of the current selected style.
Actual Behavior
I see multiple legends. Moreover the title of the CSS ones report a long UUID as stated form this issue here
Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: