geosolutions-it / geonode-mapstore-client

MapStore Client for GeoNode
Other
2 stars 132 forks source link

Missing cache in layers loaded on geonode #218

Closed ElenaGallo closed 3 years ago

ElenaGallo commented 3 years ago

Displaying a newly added layer the cache is always missing. This is the reason reported in the console:

geowebcache-cache-result: MISS geowebcache-miss-reason: exception occurred: ParameterException: Style 'states1' is invalid.

cache.png

How to reproduce

Current Result The layer is not cached.

Expected Result The layer is cached.

giohappy commented 3 years ago

The problem is that the style name inside the STYLES parameter of the GetMap request doesn't contain the workspace prefix. I suppose the WMS service assumes the workspace from the request subpath, while GWC uses the style name strictly.

Without workspace:

With workspace:

This is what happens for saved maps:

However, for layer previews and new maps, a map configuration is generated by GeoNode "on the fly". In this case the style name that is injected is the layer's default style name without the prefix. The same happens when the context for a new map is created.

In both cases probably we can safely set the style to an empty string "style": '', since it's fine to use an empty value for the style in case it is the default style.

@marthamareal please verify if this fix would be fine and it doesn't break the map legend logic. A small fix to the map legend template is probably required, because if I'm not wrong you need the style name to show it inside the sidebar. Moreover, the current way of treating style names always result in names with hash suffixes, etc. Until we don't solve it we could hide the style name and just show the legend image.

giohappy commented 3 years ago

I will move this issue to GeoNode

giohappy commented 3 years ago

Issue moved to geosolutions-it/geonode #739 via ZenHub