0

The server is very slow to produce an image when the client requests an image at a scale of 900 layers but only one layer has the requested bbox. I think that GeoServer loads information about all the layers that fall under the scale rule in the style, and then starts filtering them by BBOX. I think that if you set a bounding box in the style rule, and I think that then the GeoServer will not load information about all layers that do not fall into the BBOX of the request from the client.

I tried to use cql filter, but I can't change the request from the client and add &CQL_FILTER=test to it&

http://192.168.0.163:8080/geoserver/gwc/service/wms?STYLES=&VERSION=1.3.0&SRS=EPSG%3A3857&TRANSPARENT=TRUE&LAYERS=cite%3AALLGroup&EXCEPTIONS=INIMAGE&SERVICE=WMS&REQUEST=GetMap&FORMAT=image%2Fpng&CRS=EPSG%3A900913&BBOX=6770791.9617694,7697820.240683,6771097.7098825,7698125.9887961&WIDTH=256&HEIGHT=256

I'm trying to set a bounding box in style. Can I set a rule in the layer style that specifies the BBOX I need?

Each layer is a pyramid of images created using gdal from tiff. 100 000 * 100 000 pixels.

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

  <!-- a Named Layer is the basic building block of an SLD document -->
  <NamedLayer>
    <Name>default_raster</Name>
    <UserStyle>
    <!-- Styles can have names, titles and abstracts -->
      <Title>Default Raster</Title>
      <Abstract>A sample style that draws a raster, good for displaying imagery</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering rasters -->
      <FeatureTypeStyle>
        <Rule>
            <MinScaleDenominator>00001</MinScaleDenominator>
            <MaxScaleDenominator>10000</MaxScaleDenominator>
            <RasterSymbolizer>
                <Opacity>1.0</Opacity>
            </RasterSymbolizer>
        </Rule> 

        <gml:BBOX>
        <PropertyName>GEOMETRY</PropertyName>
        <gml:Box srsName="urn:x-ogc:def:crs:EPSG:4326">
          <gml:coord>
             <gml:X>-10</gml:X> <gml:Y>0</gml:Y>
          </gml:coord>
          <gml:coord>
             <gml:X>10</gml:X> <gml:Y>10</gml:Y>
          </gml:coord>
        </gml:Box>
      </gml:BBOX>

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

getting an error:

line 28: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.opengis.net/gml/3.2":BBOX}'. One of '{"http://www.opengis.net/sld":Rule, "http://www.opengis.net/sld":VendorOption}' is expected.

  • I don't know your use case but perhaps you could combine your 900 raster layers into one layer with raster mosaic. – user30184 Feb 18 at 9:04
  • This is really an extension of gis.stackexchange.com/questions/349668/… but you haven't answered my questions there. Filters in the styles are unlikely to help you – Ian Turton Feb 18 at 9:08
  • If you have 900 raster layers the best approach is to use a single image mosaic instead, it keeps an index of where each image is, and will quickly determine the only ones intersecting the requested BBOX. – Andrea Aime Feb 18 at 9:16
  • @user30184 Each layer is a pyramid of images created using gdal from tiff. 100 000 * 100 000 pixels. I won't be able to combine that many people into a single pyramid. – 4gexotron Feb 18 at 10:50
  • @IanTurton The problem is really one and I try to ask small questions to understand how to solve this problem. I provided logs from Geoserver, but I may have incorrectly notified you in the comment because I didn't get a response. When applying the scale rule, the server does not read data from all layers, and I think a bbox-style filter will help you not process unnecessary data. Why does GeoServer load the data of all pyramids that do not fall under the BBOX request from the client and how to prevent this? – 4gexotron Feb 18 at 11:08
0

Your filter needs to be inside a Filter element which is inside a Rule- see the SLD reference on syntax.

<Rule>
   <Filter>
     <gml:BBOX>
        <PropertyName>GEOMETRY</PropertyName>
        <gml:Box srsName="urn:x-ogc:def:crs:EPSG:4326">
          <gml:coord>
             <gml:X>-10</gml:X> <gml:Y>0</gml:Y>
          </gml:coord>
          <gml:coord>
             <gml:X>10</gml:X> <gml:Y>10</gml:Y>
          </gml:coord>
        </gml:Box>
      </gml:BBOX>
      </Filter>
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.