Maps4HTML / geoserver

Maps for HTML MapML Extension / plug-in development fork of GeoServer
https://docs.geoserver.org/latest/en/user/extensions/mapml/index.html
Other
3 stars 1 forks source link

When cascading remote layer with multiple styles, not all selected styles point to all the values available #20

Open prushforth opened 3 years ago

prushforth commented 3 years ago

This may be related to how GeoServer handles default remote styles when populating the layer styles dialog for cascaded styles:

image

In the above image, no / blank default remote style is selected from the dropdown, while both available styles are 'selected' i.e. pushed into the selected list box.

The resulting MapML document has generated alternate style links, but the 'default' style gets selected

<link href="http://localhost:8081/geoserver/mapml/nrcan:dtm-slope/osmtile?style=slope_grey" rel="style" title="slope_grey" >
<link href="http://localhost:8081/geoserver/mapml/nrcan:dtm-slope/osmtile?style=slope_color" rel="style" title="slope_color" >
<link href="http://localhost:8081/geoserver/mapml/nrcan:dtm-slope/osmtile?style=" rel="self style" title="" >

which looks bad, because you haven't selected a value for the default style, it treats a null string as the style name:

image

When you select one of the options that is not null string as the default style, it does indeed show these options correctly in the first response:

image

results in

<link href="http://localhost:8081/geoserver/mapml/nrcan:dtm-slope/osmtile?style=slope_color" rel="style" title="slope_color">
<link href="http://localhost:8081/geoserver/mapml/nrcan:dtm-slope/osmtile?style=" rel="self style" title="slope_grey">

which correctly generates the styles options in the client:

image

but the bug appears when you select one of those options in the client, which follows the generated link to (in this case) style=slope_color, which returns a MapML document containing only this link:

<link href="http://localhost:8081/geoserver/mapml/nrcan:dtm-slope/osmtile?style=slope_color" rel="self style" title="slope_color">

when it should also contain a link to the slope_grey style from which the user navigated.

The above behaviour seems to be different than that which occurs when you select alternate styles for a local layer, for example the states shapefile has many available styles:

image

which results in a MapML document containing:

<link href="http://localhost:8081/geoserver/mapml/topp:states/osmtile?style=pophatch" rel="style" title="pophatch" />
<link href="http://localhost:8081/geoserver/mapml/topp:states/osmtile?style=polygon" rel="style" title="polygon" />
<link <href="http://localhost:8081/geoserver/mapml/topp:states/osmtile?style=" rel="self style" title="population" />

Which correctly generates the options and when you follow one of the options, the return links are also correctly generated as options:

<link href="http://localhost:8081/geoserver/mapml/topp:states/osmtile?style=polygon" rel="style" title="polygon" />
<link href="http://localhost:8081/geoserver/mapml/topp:states/osmtile?style=population" rel="style" title="population" />
<link href="http://localhost:8081/geoserver/mapml/topp:states/osmtile?style=pophatch" rel="self style" title="pophatch" />