geosolutions-it / geoserver

Official GeoServer repository
http://geoserver.org
Other
10 stars 7 forks source link

Style Layer Descriptor -type Style Group zoom range limited to first NamedLayer scale denominator range #366

Closed prushforth closed 6 months ago

prushforth commented 6 months ago

@turingtestfail here's a description of the bug. I will produce a test sld that can be added to the MapML extension test suite if you confirm.

Thanks

turingtestfail commented 6 months ago

Peter, I am seeing the behavior you mentioned but I am not sure about the origin of the issue. I created a simple SLD for the sample "world" GeoServer layergroup, called "worldgroup". (see below) When I zoom in past the first MinScaleDenominator the viewer appears blank. But when I looked at the browser request log I saw this:

http://localhost:8080/geoserver/ne/wms?request=GetMap&crs=MapML:WGS84&service=WMS&bbox=-578.84765625,-2.4609375,-241.34765625,66.62109375&layers=world&format=image/png&width=1920&styles=&language=en&version=1.3.0&transparent=true&height=393

Which, when I pasted into another browser tab gave me an image: [image: image.png]

Could this be a client viewer issue?

Joe

<?xml version="1.0" encoding="ISO-8859-1"?> <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc">

<NamedLayer>
    <Name>ne:countries</Name>

    <UserStyle>
        <Title>Atlas of Canada Colours</Title>
        <FeatureTypeStyle>
            <Rule>
                <MinScaleDenominator>20000000</MinScaleDenominator>
                <PolygonSymbolizer>
                    <Fill>
                        <CssParameter name="fill">#b5ffe4</CssParameter>
                    </Fill>
                    <Stroke>
                        <CssParameter

name="stroke">#232323 <CssParameter name="stroke-opacity">0 <CssParameter name="stroke-width">1 <CssParameter name="stroke-linejoin">bevel

#9ad9c2 1 bevel square
            </Rule>
        </FeatureTypeStyle>
    </UserStyle>
</NamedLayer>
<NamedLayer>
    <Name>ne:populated_places</Name>

    <UserStyle>
        <Title>Atlas of Canada Colours</Title>
        <FeatureTypeStyle>
            <Rule>

                <MinScaleDenominator>10000000</MinScaleDenominator>
                <MaxScaleDenominator>20000000</MaxScaleDenominator>
                <PointSymbolizer>
        <Graphic>
          <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
              <CssParameter name="fill">#777777</CssParameter>
            </Fill>
          </Mark>
          <Size>3</Size>
        </Graphic>
      </PointSymbolizer>

            </Rule>

        </FeatureTypeStyle>
    </UserStyle>
</NamedLayer>

On Tue, Mar 19, 2024 at 9:45 AM Peter Rushforth @.***> wrote:

@turingtestfail https://github.com/turingtestfail here's a description https://github.com/Maps4HTML/geoserver/issues/60 of the bug. I will produce a test sld that can be added to the MapML extension test suite if you confirm.

Thanks

— Reply to this email directly, view it on GitHub https://github.com/geosolutions-it/geoserver/issues/366, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHRJZ4VKTA7HFANVGYS7IW3YZA6RHAVCNFSM6AAAAABE5TDCQ2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4TKMBSGE4DKNQ . You are receiving this because you were mentioned.Message ID: @.***>

prushforth commented 6 months ago

Peter, I am seeing the behavior you mentioned but I am not sure about the origin of the issue. I created a simple SLD for the sample "world" GeoServer layergroup, called "worldgroup". (see below) When I zoom in past the first MinScaleDenominator the viewer appears blank.

I created a style with the sld above (wouldn't validate, not sure if that has any effect; I tweaked the schemaLocation until it validated). I validated in the style editor that the style group worked to change the view of the world to that of populated places only at scale denominators between 10 and 20 million. At scale denominators larger than 20 million, only the countries were shaded. When I create a Layer Group using that Style group only, I am able to view the layer in MapML preview mode, but I can't zoom in far enough to expose the populated places layer - it only goes up to zoom=4 (OSMTILE). By default, (well actually, it can't be changed by the user at this time), the viewer limits the zoom button enabled/disabled to match the set of zoom levels given it in the \, which as you can see below is limited to 4. At z=5, the populated places layer should take over.

On the other hand, if I set up a Layer group without using a Style group, for the same layers, I can indeed zoom in and get the different layers at larger scales.

image

turingtestfail commented 6 months ago

@prushforth @aaime Thanks that helped me narrow it down. I am using a GeoServer method called CapabilityUtil.searchMinMaxScaleDenominator to look up the denominators and calculate min and max zoom levels. ( https://github.com/geoserver/geoserver/blob/0ab715486a958632e9e7d54ad5746a4858189f3b/src/wms/src/main/java/org/geoserver/wms/capabilities/CapabilityUtil.java#L42 )

Unfortunately that method does not take into account the possibility that there might be more than one NamedLayer in the SLDs it searches. This bug pre-exists our current MapML efforts but it is a relatively quick fix so I will take a look at submitting a patch as soon as possible.

prushforth commented 6 months ago

This bug pre-exists our current MapML efforts but it is a relatively quick fix so I will take a look at submitting a patch as soon as possible.

OK, thanks for that. I noticed that the Preview as Style Group checkbox in the style editor does enable the subsequent NamedLayers, so likely it doesn't go through that same function.

turingtestfail commented 6 months ago

@prushforth @aaime The fix for this is in this PR https://github.com/geoserver/geoserver/pull/7506 Please let me know if it resolves the issue.

prushforth commented 6 months ago

It sure does! Thanks for this, it is really working well.

prushforth commented 6 months ago

I must have been mistaken before when I said this:

This bug pre-exists our current MapML efforts but it is a relatively quick fix so I will take a look at submitting a patch as soon as possible.

OK, thanks for that. I noticed that the Preview as Style Group checkbox in the style editor does enable the subsequent NamedLayers, so likely it doesn't go through that same function.

because we tested the "Preview as Style Group" just now and it wouldn't go beyond zoom=3, but the MapML preview works perfectly now.

prushforth commented 6 months ago

OK I apologize again: the problem, if it existed with the "Preview as Style Group" does not exist now. It was a stylesheet snafu.