1

We use Mapserver to create a composite of multiple layers from another WMS server. We noticed that a single request to Mapserver creates multiple requests to the "upstream" WMS server. Apparently Mapserver uses smaller tiles (that are based on the layer "SizeX" and "SizeY" config) instead of using the request bounding box it received.

E.g. incoming request to Mapserver:
enter image description here

And what Mapserver requests from the upstream WMS server (4 tiles):
enter image description here

Is there a way to disable this behavior in Mapcache? It should just use whatever bbox and resolution it got in its request for the upstream query.

We are using Mapserver 6.4.1-3~precise2 on Ubuntu but will upgrade fairly soon.

Our Mapserver config of the layer in question:

CONNECTIONTYPE UVRASTER
DATA "<GDAL_WMS>
          <Service name=\"WMS\">
              <Version>1.1.1</Version>
              <ServerUrl>http://host/wms?&amp;TIME=%TIME%&amp;PROJECTION=%2Binit%3Depsg%3A3857&amp;ENCODER=ENC1&amp;</ServerUrl>
              <SRS>EPSG:3857</SRS>
              <ImageFormat>image/png</ImageFormat>
              <Transparent>TRUE</Transparent>
              <Layers>L1</Layers>
          </Service>
          <DataWindow>
              <UpperLeftX>-20037508.34</UpperLeftX>
              <UpperLeftY>20037508.340</UpperLeftY>
              <LowerRightX>20037508.34</LowerRightX>
              <LowerRightY>-20037508.34</LowerRightY>
              <SizeX>40075</SizeX>
              <SizeY>40075</SizeY>
          </DataWindow>
          <BlockSizeX>256</BlockSizeX>
          <BlockSizeY>256</BlockSizeY>
          <Projection>EPSG:3857</Projection>
          <BandsCount>4</BandsCount>
          <DataType>Byte</DataType>
          <MaxConnections>4</MaxConnections>
          <OverviewCount>10</OverviewCount>
      </GDAL_WMS>"
1

Read http://www.gdal.org/frmt_wms.html where you see this information about BlockSizeX and BlockSizeY:

Block size in pixels. (optional, defaults to 1024, except for VirtualEarth)

If 1024 by 1024 is big enough window for your application you can just remove BlockSixeX and BlockSizeY, otherwise use as large blocks as you need.

I do not understand what does a WMS layer like this have to do with CONNECTIONTYPE UVRASTER. Could you clarify?

And while you can use GDAL for this purpose, usual way to cascading WMS with MapServer is this http://mapserver.gis.umn.edu/ogc/wms_client.html.

For your WMS server the LAYER would be something like

LAYER
  NAME "cascaded_wms"
  TYPE RASTER
  STATUS ON
  CONNECTION "http://host/wms?TIME=%TIME%&ENCODER=ENC1"
  CONNECTIONTYPE WMS
  METADATA
    "wms_srs"             "EPSG:3857"
    "wms_name"            "L1"
    "wms_server_version"  "1.1.1"
    "wms_format"          "image/png"
  END
END
  • Setting BlockSizeX/Y to 1024 did not work. Mapserver only did a single request, but queried a huge bounding box. We're trying to reduce the size of the queried bbox, since the upstream WMS server does some expensive on-demand calculations. – Christian Aichinger Aug 28 '17 at 13:57
  • BlockSize should have an effect on &WIDTH and &HEIGHT in the GetMap request. Reducing the BBOX must happen in your client. However, I am not sure how GDAL behaves in this use case. Turn your layer into CONNECTIONTYPE WMS and GetMaps will be sent as they come in if there is no need for re-projection. – user30184 Aug 28 '17 at 14:00
  • Our client requests a sane bbox from mapserver - Mapserver itself then decides to fetch different (larger or smaller, depending on BlockSize) tiles from the upstream WMS server - that's the behavior we want to disable. Mapserver should just use whatever bbox it got in its request. – Christian Aichinger Aug 28 '17 at 14:05
  • UVRASTER: We use it to draw wind-vane type maps, but this should be independent of the upstream WMS query. – Christian Aichinger Aug 28 '17 at 14:05
  • So this layer is used for vector fields mapserver.gis.umn.edu/input/vector/vector_field.html and it is not a normal cascaded map layer? In that case show the whole LAYER. – user30184 Aug 28 '17 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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