1

Problem

Problem Summary

I want the response of all the MapServer WMS GetCapabilities requests to not show queryable="1" in the root layers XML node.

Status Quo

The GetCapabilities response looks like this:

<Layer queryable="1">
  <Name>[value of MAP>NAME]</Name>
  <Layer queryable="1" opaque="0" cascaded="0">
    <Name>[value of MAP>LAYER>NAME]</Name>

The mapfile looks something like this:

MAP
  NAME 'SERVICE_NAME' 
  STATUS ON
  SIZE 500 500    
  UNITS meters
  SYMBOLSET '/PATH/TO/SYMBOLS'
  FONTSET '/PATH/TO/FONTSET'
  MAXSIZE 20000
  EXTENT 2513000 5401999 2604000 5501999
  PROJECTION
      "init=epsg:31466"
  END
  SHAPEPATH '/PATH/TO/SHAPE/DATA'
  OUTPUTFORMAT
    NAME png
    DRIVER 'AGG/PNG'
    MIMETYPE 'image/png'
    IMAGEMODE RGBA
    EXTENSION 'png'
    TRANSPARENT ON    
  END

  LEGEND
    IMAGECOLOR 255 255 255
    STATUS ON
    TRANSPARENT ON
    KEYSIZE 18 12
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 89
    END
  END

  WEB
    // ...
    METADATA
    // ...
    END
  END

  // Now the layers

END

Desired State

The response should look like this:

<Layer>
  <Name>[value of MAP>NAME]</Name>
  <Layer queryable="1" opaque="0" cascaded="0">
    <Name>[value of MAP>LAYER>NAME]</Name>

Additional Context

  • Debian Buster
  • MapServer v7.2.2

<!-- MapServer version 7.2.2 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->

Question

How can I disable the queryable attribute as default for root layers?

My research

When I tried to find the options in the documentation all I found was "To be queryable, each mapfile LAYER must have a TEMPLATE defined, or each CLASS within the LAYER must have a TEMPLATE defined." Introduction to MapServer. This does however not mention how to influence the behaviour of the root layer.

This behavior seems to have changed from the version used in Debian Stretch to v7.2.2. I would usually not care, but I have follow up problems due to this attribute and they did not exist in the previous version.

5
  • 1
    The change may be related to github.com/mapserver/mapserver/issues/5404.
    – user30184
    Sep 13, 2021 at 11:48
  • Hi @user30184 yeah, that seems related. A solution got merged in github.com/MapServer/MapServer/pull/5405, so I could just remove the root-layer entirely; but only with a newer version of MapServer as it seems. I'll have a look at the implications on that on my issue. Thanks!
    – SvenTUM
    Sep 13, 2021 at 12:12
  • 1
    Also in older versions the root layer should not appear if you use an empty NAME ''.
    – user30184
    Sep 13, 2021 at 12:25
  • Hi! @user30184 that solved my problem, if you want you can write the answer and I'll accept it. I just needed to add to the MAP>WEB>METADATA: 'wms_rootlayer_name' '' as described in WMS Server Docs. The docs are generally talking about the root layer though and not espacially about the queryable attribute. The result is as I wanted it in my Question, the layer is still listed, but the queryable attribute is gone.
    – SvenTUM
    Sep 13, 2021 at 12:40
  • Would you rather write the answer yourself because you know now what to do better than I?
    – user30184
    Sep 13, 2021 at 12:44

1 Answer 1

1

The described desired state got achieved by adding the following line in the mapfile. This has to be done per mapfile as there is no such default available just yet.

MAP
// ...
  WEB
  // ...
    METADATA
    // ...
      'wms_rootlayer_name' ''
    // ^ this line has to be added!
    END
  END
// ...
END

The result will be almost exactly as described in Desired State:

<Layer>
  <Layer queryable="1" opaque="0" cascaded="0">
    <Name>[value of MAP>LAYER>NAME]</Name>

The root-layers <Name> tag is also gone, but more importantly the queryable="1" is being omitted.


The solution was pointed out by @user30184 in the comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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