A layer is not hide-able when it is in a wms_layer_group #4533

Closed
aperi2007 opened this Issue Nov 29, 2012 · 14 comments

Projects

None yet

4 participants

@aperi2007

I notice that the option
"wms_enable_request" "!*"
to hide a layer from the GetCapabilities responsework only when a layer is not grouped using the option
"wms_layer_group"

Googling I find also this old ticket:
http://trac.osgeo.org/mapserver/ticket/3931

AFAIK this ticket say that the issue was resolved for the GROUP option but never for the wms_layer_group.

I test this on the mapserver 6.3-svn and actually the issue is still open.

If a layer is on a named group with the wms_layer_group option it is not hidden-able using the
"wms_enable_request" "!*"
option.

@Schpidi
Member
Schpidi commented Jan 3, 2013

This should have been covered with these tests but apparently I've overlooked this specific case. Thanks for reporting, I'll have a look.

FYI the referenced ticket is now here: #3931

@aperi2007

Hi,

Can you confirm this bug ?

@Schpidi
Member
Schpidi commented Feb 6, 2013

Hi,

yes, I had an initial look at it but it turned out to be more involved. I hope to find some time soon.

@szekerest szekerest was assigned Mar 3, 2013
@szekerest
Member

Issue is now fixed in master and branch-6-2

@szekerest
Member

This change requires to update ows_wms_capabilities.xml in msautotest.

@aperi2007

I check the change.
Apply-ing a
"wms_enable_request" "!GetCapabilities"
to a layer on a group defined with the
wms_group_layer
will produce an error in the XML returned from a getcapabilities.

This is the error returned as seem from a browser.

XML Parsing Error: mismatched tag. Expected: .
Location: http://localhost/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc&SERVICE=WMS&REQUEST=GetCapabilities
Line Number 1879, Column 5:

I check the XML returned comparing it with the xml it will return if not apply the !getCapabilites.

I notice it apply always the same number of

     </Layer>
    </Layer>
  </Layer>
</Layer>

Instead when the !getCapabilities is applied it should remove a for every !getCapabilites
applied.

Andrea.

@szekerest
Member

Could you provide a sample map file to be able to reproduce the same issue?

@aperi2007

This is a working map file .
It correctly return an xml response from a GetCapabilites request.

MAP 
  #
  NAME      "test"  #name to give your map service
  SIZE      800 600
  MAXSIZE   4096
  UNITS meters
  ANGLE       0
  CONFIG "PROJ_LIB" "/usr/local/share/proj/"
  CONFIG "ON_MISSING_DATA" "LOG"
  DEBUG 4
  PROJECTION
    "+init=epsg:25832 +towgs84=0,0,0,0,0,0,0"
  END
  DEFRESOLUTION 91
  RESOLUTION 91
  IMAGECOLOR 255 255 255
  IMAGETYPE PNG8
  OUTPUTFORMAT
    NAME "AGGA"
    DRIVER AGG/PNG
    MIMETYPE "image/png"
    IMAGEMODE RGBA    #serve RGBA per avere il trasparente
    EXTENSION "png"
    FORMATOPTION "GAMMA=0.75"
    FORMATOPTION "INTERLACE=true"
    FORMATOPTION "QUANTIZE_DITHER=OFF"
    FORMATOPTION "COMPRESSION=6"  # Compression: 0=no compression, 9=best, 6=default compression
    FORMATOPTION "QUANTIZE_FORCE=ON"
    FORMATOPTION "QUANTIZE_COLORS=256"
    TRANSPARENT ON
  END
  WEB
    MINSCALEDENOM 1
    MAXSCALEDENOM 4000000
    METADATA
      "wms_title" "test"
      "wms_onlineresource" "http://localhost/wmsraster/com.rt.wms.RTmap/wms?map=test&"
      "wms_srs" "EPSG:25832 EPSG:3003 EPSG:4326 EPSG:3857"
      #"wms_feature_info_mime_type" "application/vnd.ogc.gml,application/vnd.ogc.wms_xml, text/xml, text/html, text/plain"
      "wms_enable_request" "*"
    END
  END 
  # End Web
  # layers we will want to display
  # Start of LAYER DEFINITIONS ---------------------------------------------
  LAYER
    NAME "layer1"
    STATUS OFF
    TYPE POINT
    METADATA
      "wms_title" "layer1"
      #  "wms_srs" "EPSG:25832 EPSG:3003 EPSG:4326"
      "wms_layer_group" "/layer1/layer2/layer3"
    END
  END
#-----
  LAYER
    NAME "layer2"
    STATUS OFF
    TYPE POINT
    # ... other standard raster processing functions here
    METADATA
      "wms_title" "layer2"
      "wms_layer_group" "/layer1/layer2/layer3"
      #"wms_enable_request" "!GetCapabilities"
    END
  END
#-----
  LAYER
    NAME "layer3"
    STATUS OFF
    TYPE LINE
    TRANSFORM LL
    UNITS percentages
    FEATURE
      POINTS 0.02 -0.5 0.98 -0.50 END
      TEXT 'text- blah blah'
    END
    METADATA
      "wms_title" "layer3"
      "wms_layer_group" "/layer1/layer2/layer3"
    END
    CLASS
      LABEL
        TYPE TRUETYPE
        FORCE true
        BUFFER 1
        COLOR "#FFFFFF25"
        ANTIALIAS false
        PRIORITY 10
        SIZE 130
        ANGLE auto
        OFFSET 0 140
        FONT "LiberationSansNarrow-Bold"
        POSITION LR
        REPEATDISTANCE 1000
      END
    END
  END
#======
  # End of LAYER DEFINITIONS -------------------------------
  # INCLUDE "layers.inc.map"
END # Map File

Adding a metadata
"wms_enable_request" "!GetCapabilities"
to the layer2 definition.

It is removed from group but the tags


are not correctly closed.

This is the sample with the
"wms_enable_request" "!GetCapabilities" added.

MAP 
  #
  NAME      "test"  #name to give your map service
  SIZE      800 600
  MAXSIZE   4096
  UNITS meters
  ANGLE       0
  CONFIG "PROJ_LIB" "/usr/local/share/proj/"
  CONFIG "ON_MISSING_DATA" "LOG"
  DEBUG 4
  PROJECTION
    "+init=epsg:25832 +towgs84=0,0,0,0,0,0,0"
  END
  DEFRESOLUTION 91
  RESOLUTION 91
  IMAGECOLOR 255 255 255
  IMAGETYPE PNG8
  OUTPUTFORMAT
    NAME "AGGA"
    DRIVER AGG/PNG
    MIMETYPE "image/png"
    IMAGEMODE RGBA    #serve RGBA per avere il trasparente
    EXTENSION "png"
    FORMATOPTION "GAMMA=0.75"
    FORMATOPTION "INTERLACE=true"
    FORMATOPTION "QUANTIZE_DITHER=OFF"
    FORMATOPTION "COMPRESSION=6"  # Compression: 0=no compression, 9=best, 6=default compression
    FORMATOPTION "QUANTIZE_FORCE=ON"
    FORMATOPTION "QUANTIZE_COLORS=256"
    TRANSPARENT ON
  END
  WEB
    MINSCALEDENOM 1
    MAXSCALEDENOM 4000000
    METADATA
      "wms_title" "test"
      "wms_onlineresource" "http://localhost/wmsraster/com.rt.wms.RTmap/wms?map=test&"
      "wms_srs" "EPSG:25832 EPSG:3003 EPSG:4326 EPSG:3857"
      #"wms_feature_info_mime_type" "application/vnd.ogc.gml,application/vnd.ogc.wms_xml, text/xml, text/html, text/plain"
      "wms_enable_request" "*"
    END
  END 
  # End Web
  # layers we will want to display
  # Start of LAYER DEFINITIONS ---------------------------------------------
  LAYER
    NAME "layer1"
    STATUS OFF
    TYPE POINT
    METADATA
      "wms_title" "layer1"
      #  "wms_srs" "EPSG:25832 EPSG:3003 EPSG:4326"
      "wms_layer_group" "/layer1/layer2/layer3"
    END
  END
#-----
  LAYER
    NAME "layer2"
    STATUS OFF
    TYPE POINT
    # ... other standard raster processing functions here
    METADATA
      "wms_title" "layer2"
      "wms_layer_group" "/layer1/layer2/layer3"
      "wms_enable_request" "!GetCapabilities"
    END
  END
#-----
  LAYER
    NAME "layer3"
    STATUS OFF
    TYPE LINE
    TRANSFORM LL
    UNITS percentages
    FEATURE
      POINTS 0.02 -0.5 0.98 -0.50 END
      TEXT 'text- blah blah'
    END
    METADATA
      "wms_title" "layer3"
      "wms_layer_group" "/layer1/layer2/layer3"
    END
    CLASS
      LABEL
        TYPE TRUETYPE
        FORCE true
        BUFFER 1
        COLOR "#FFFFFF25"
        ANTIALIAS false
        PRIORITY 10
        SIZE 130
        ANGLE auto
        OFFSET 0 140
        FONT "LiberationSansNarrow-Bold"
        POSITION LR
        REPEATDISTANCE 1000
      END
    END
  END
#======
  # End of LAYER DEFINITIONS -------------------------------
  # INCLUDE "layers.inc.map"
END # Map File

Andrea.

@szekerest
Member

I hope the fix above will solve the issue with the layer closing tags
Also fixed the memory corruption when all layers are added to the same group

@aperi2007

Hi,
It work like a charm.

great !

@szekerest
Member

closing

@szekerest szekerest closed this Mar 5, 2013
@tbonfort
Member
tbonfort commented Mar 5, 2013

re-opening until the failing autotests are fixed

@tbonfort tbonfort reopened this Mar 5, 2013
@szekerest
Member

I already updated ows_wms_capabilities.xml in msautotest, but it doesn't seem to have effect

@tbonfort tbonfort added a commit that referenced this issue Mar 5, 2013
@tbonfort tbonfort update autotests for #4533 81f81e0
@tbonfort tbonfort added a commit that referenced this issue Mar 5, 2013
@tbonfort tbonfort update autotests for #4533 c68c0f6
@tbonfort
Member
tbonfort commented Mar 5, 2013

@szekerest the autotest submodule needed to be updated in the mapserver source tree. c.f. the instructions in https://github.com/mapserver/mapserver/wiki/Test-Suite

@tbonfort tbonfort closed this Mar 5, 2013
@mkofahl mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
@szekerest szekerest Mark disabled layers as processed to prevent from being displayed in …
…nested groups (#4533)
16edb13
@mkofahl mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
@szekerest szekerest Fix issues with wms_layer_group printing (#4533) 399fe84
@mkofahl mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
@tbonfort tbonfort update autotests for #4533 f53e56a
@mkofahl mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
@tbonfort tbonfort update autotests for #4533 f80c64d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment