Re: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend

2016-09-16 Thread Andrea Peri
It is done using two layer. Mutually exclusive each other for scale
and grouped using the "wms_layer_group" setting.

  LAYER
NAME "rt_ofc.10k88"
STATUS OFF
EXTENT 545379 4673155 776461 4927945
TYPE raster
TILEINDEX '/path-to/raster/ofc_1988_10k_bn/tiff_tiled/index_tiled'
TILEITEM 'location'
PROCESSING "BANDS=1"
PROCESSING "NODATA=0"
METADATA
  "wms_title" "OFC 1988"
  "wms_abstract" "..."
  "wms_layer_group" "/rt_ofc.10k88"
END
MAXSCALEDENOM 128100
MINSCALEDENOM 1
# the color index for transparent
OFFSITE 0 0 0
# the global opacity (100=full opaque)
OPACITY 100
  END
#-
  LAYER
NAME "rt_ofc.10k88.lite"
STATUS OFF
EXTENT 545379 4673155 776461 4927945
TYPE raster
TILEINDEX '/path-to/ofc_1988_10k_bn/tiff_tiled_lite_version/index_tiled'
TILEITEM 'location'
PROCESSING "BANDS=1"
PROCESSING "NODATA=0"
# ... other standard raster processing functions here
METADATA
  "wms_title" "OFC 1988 Lite"
  "wms_abstract" "..."
  "wms_layer_group" "/rt_ofc.10k88"
  "ows_enable_request" "!GetCapabilities"
END
MAXSCALEDENOM 500
MINSCALEDENOM 128100
# the color index for transparent
OFFSITE 0 0 0
# the global opacity (100=full opaque)
OPACITY 100
  END
#-
  LAYER
NAME "rt_ofc.10k88.qu"
STATUS OFF
TYPE POLYGON
EXTENT 545379 4673155 776461 4927945
DATA '/home/raster/ofc_1988_10k_bn/tiff_tiled/index_tiled'
PROJECTION
  "init=epsg:25832"
END
METADATA
  "wms_title" "OFC 1988 Quadro di unione"
  "wms_extent" "545379.0 4673155.0 776461.0 4927945.0"
  "wms_abstract" "..."
  "wms_bbox_extended" "true"
  "ows_include_items" "all"
  "gml_include_items" "all"
  "ows_enable_request" "*"
  "gml_geometries" "GEOMETRY"
  "ows_geomtype" "MultiPolygon"
  "gml_geometry_type" "multipolygon"
  "gml_types"   "none"
  "gml_PK_UID_type" "int"
END
MAXSCALEDENOM 500
MINSCALEDENOM 1
OPACITY 100
PROCESSING "APPROXIMATION_SCALE=FULL"
CLASS
  NAME 'Quadro unione ofc 1988'
  TEXT '[NAME]'
  LABEL
....
      END
      STYLE
    
  END

END
  END

2016-09-16 19:08 GMT+02:00 Lime, Steve D (MNIT) <steve.l...@state.mn.us>:
> Indeed it does - interesting feature! What does the layer definition for 
> rt_ofc.10k88 look like?
>
> -Original Message-
> From: Andrea Peri [mailto:aperi2...@gmail.com]
> Sent: Friday, September 16, 2016 9:55 AM
> To: Lime, Steve D (MNIT) <steve.l...@state.mn.us>
> Cc: mapserver-users@lists.osgeo.org
> Subject: Re: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend
>
> The question s about the legend retrieved from qgis using a
> getlegendgraphic request when add a wms to a canvas.
> The trouble is issuing when the ortophoto is grouped using a
> "wms_layer_group" setting and has no any style defined in it.
>
> As example, you can you try to connect to our mapserver wms of
> ortophotos using the last qgis 2.16 or 2.14.5 ?
>
> This is the url:
> http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc
> and the layer to choose is the "rt_ofc.10k88"
>
> As you can see the qgis will retrieve ALL the legends of ALL the
> vector layers available in the same wms service.
> I don't understand if the wrong response is from mapserver or from
> qgis that wrongly require the legend to the parent layer, rretrieving
> so all the legends from all the layers availables.
>
> A.
>
> And add to a empty canvas the
>
> 2016-09-16 16:35 GMT+02:00 Lime, Steve D (MNIT) <steve.l...@state.mn.us>:
>> Hi Andrea: I guess I'm not sure exactly what you're asking. With 
>> latest/greatest QGIS raster WMS layers (e.g. aerial photos) show up fine in 
>> the QGIS legend if I have a KEYIMAGE set in the layer object. --Steve
>>
>> -Original Message-
>> From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On 
>> Behalf Of Andrea Peri
>> Sent: Thursday, September 08, 2016 8:11 AM
>> To: mapserver-users@lists.osgeo.org
>> Subject: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend
>>
>> Hi post here a response from the qgis-user list about a question on
>> the GetLegendGraphics.
>> With th

Re: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend

2016-09-16 Thread Lime, Steve D (MNIT)
Indeed it does - interesting feature! What does the layer definition for 
rt_ofc.10k88 look like?

-Original Message-
From: Andrea Peri [mailto:aperi2...@gmail.com] 
Sent: Friday, September 16, 2016 9:55 AM
To: Lime, Steve D (MNIT) <steve.l...@state.mn.us>
Cc: mapserver-users@lists.osgeo.org
Subject: Re: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend

The question s about the legend retrieved from qgis using a
getlegendgraphic request when add a wms to a canvas.
The trouble is issuing when the ortophoto is grouped using a
"wms_layer_group" setting and has no any style defined in it.

As example, you can you try to connect to our mapserver wms of
ortophotos using the last qgis 2.16 or 2.14.5 ?

This is the url:
http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc
and the layer to choose is the "rt_ofc.10k88"

As you can see the qgis will retrieve ALL the legends of ALL the
vector layers available in the same wms service.
I don't understand if the wrong response is from mapserver or from
qgis that wrongly require the legend to the parent layer, rretrieving
so all the legends from all the layers availables.

A.

And add to a empty canvas the

2016-09-16 16:35 GMT+02:00 Lime, Steve D (MNIT) <steve.l...@state.mn.us>:
> Hi Andrea: I guess I'm not sure exactly what you're asking. With 
> latest/greatest QGIS raster WMS layers (e.g. aerial photos) show up fine in 
> the QGIS legend if I have a KEYIMAGE set in the layer object. --Steve
>
> -Original Message-
> From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On 
> Behalf Of Andrea Peri
> Sent: Thursday, September 08, 2016 8:11 AM
> To: mapserver-users@lists.osgeo.org
> Subject: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend
>
> Hi post here a response from the qgis-user list about a question on
> the GetLegendGraphics.
> With the last version of qgis, when try to add in qgis a layer wms of
> kind RASTER the qgis retrieve the legend OF ALL the layer available in
> the service.
> I guess this was a bug. But instead as the qgis guys response me seem
> to be a right action.
> The question seem that a layer wms should aALWAYS return a style. So
> the question I guess is more interesting for the mapserver list:
> A WMS LAYER of kind IMAGE (a catalogue of ortophoto as example) should
> always have a style ?
>
> (sorry for long thread repost, but I guess is better to post all the
> discussion to help understand)
>
> Thx,
>
> Andrea.
>
>
> 2016-09-08 14:45 GMT+02:00 Richard Duivenvoorde <rdmaili...@duif.net>:
>>
>> Hi Andrea,
>>
>> note that I also added a comment at the code which is reponsible for this:
>>
>> https://github.com/qgis/QGIS/commit/69bed218373b3f93671f65bc3d02c45cbf683a48#comments
>>
>> Patrick's response there on this (see comment):
>>
>> "
>> IMHO, there is nothing to fix in QGIS, here. If a layer defines no
>> style, it's wanted that it inherits the parent layer's style. Have a
>> look at chapter 7.2.4.6.5 of the WMS implementation specification:
>>
>> Style declarations are inherited by child Layers. A child shall not
>> redefine a Style with the same Name as one
>> inherited from a parent. A child may define a new Style with a new Name
>> that is not available for the parent Layer.
>>
>> This PR is just a workaround for MapServer that is defining a style
>> named default for both the parent and the child layers. This was making
>> QGIS show 2 default styles for every child layers. Style inheritance was
>> already there before. Now at has just a saner behavior in regard to
>> non-standard compliant servers.
>>
>> I'll let you forward that to the user ML. I was not subscribed to it and
>> therefore cannot reply directly to the thread.
>> "
>>
>> So in short: mapserver does not define a style for the actual layer, so
>> qgis tries to get the style (AND it's legendgraphic) from the parent
>> layer/node:
>>
>> http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc=GetCapabilities=WMS
>>
>> in this case mapserver's rootnode, which has a legendgraphic with all
>> child symbols...
>>
>> so my fix would be: define a style for the child layer 'rt_ofc.10k54',
>> so I do not think it has something to do with the dot in the naming?
>>
>> Regards,
>>
>> Richard Duivenvoorde
>>
>>
>> On 03-09-16 20:42, aperi2007 wrote:
>>> Hi Richard,
>>>
>>>
>>> I tested also the QGIS 2.8 and the QGIS 2.12 no one of them has this issue.
>>>
>>>>Bingo: that is the one we are actually retrieving

Re: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend

2016-09-16 Thread Andrea Peri
The question s about the legend retrieved from qgis using a
getlegendgraphic request when add a wms to a canvas.
The trouble is issuing when the ortophoto is grouped using a
"wms_layer_group" setting and has no any style defined in it.

As example, you can you try to connect to our mapserver wms of
ortophotos using the last qgis 2.16 or 2.14.5 ?

This is the url:
http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc
and the layer to choose is the "rt_ofc.10k88"

As you can see the qgis will retrieve ALL the legends of ALL the
vector layers available in the same wms service.
I don't understand if the wrong response is from mapserver or from
qgis that wrongly require the legend to the parent layer, rretrieving
so all the legends from all the layers availables.

A.

And add to a empty canvas the

2016-09-16 16:35 GMT+02:00 Lime, Steve D (MNIT) :
> Hi Andrea: I guess I'm not sure exactly what you're asking. With 
> latest/greatest QGIS raster WMS layers (e.g. aerial photos) show up fine in 
> the QGIS legend if I have a KEYIMAGE set in the layer object. --Steve
>
> -Original Message-
> From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On 
> Behalf Of Andrea Peri
> Sent: Thursday, September 08, 2016 8:11 AM
> To: mapserver-users@lists.osgeo.org
> Subject: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend
>
> Hi post here a response from the qgis-user list about a question on
> the GetLegendGraphics.
> With the last version of qgis, when try to add in qgis a layer wms of
> kind RASTER the qgis retrieve the legend OF ALL the layer available in
> the service.
> I guess this was a bug. But instead as the qgis guys response me seem
> to be a right action.
> The question seem that a layer wms should aALWAYS return a style. So
> the question I guess is more interesting for the mapserver list:
> A WMS LAYER of kind IMAGE (a catalogue of ortophoto as example) should
> always have a style ?
>
> (sorry for long thread repost, but I guess is better to post all the
> discussion to help understand)
>
> Thx,
>
> Andrea.
>
>
> 2016-09-08 14:45 GMT+02:00 Richard Duivenvoorde :
>>
>> Hi Andrea,
>>
>> note that I also added a comment at the code which is reponsible for this:
>>
>> https://github.com/qgis/QGIS/commit/69bed218373b3f93671f65bc3d02c45cbf683a48#comments
>>
>> Patrick's response there on this (see comment):
>>
>> "
>> IMHO, there is nothing to fix in QGIS, here. If a layer defines no
>> style, it's wanted that it inherits the parent layer's style. Have a
>> look at chapter 7.2.4.6.5 of the WMS implementation specification:
>>
>> Style declarations are inherited by child Layers. A child shall not
>> redefine a Style with the same Name as one
>> inherited from a parent. A child may define a new Style with a new Name
>> that is not available for the parent Layer.
>>
>> This PR is just a workaround for MapServer that is defining a style
>> named default for both the parent and the child layers. This was making
>> QGIS show 2 default styles for every child layers. Style inheritance was
>> already there before. Now at has just a saner behavior in regard to
>> non-standard compliant servers.
>>
>> I'll let you forward that to the user ML. I was not subscribed to it and
>> therefore cannot reply directly to the thread.
>> "
>>
>> So in short: mapserver does not define a style for the actual layer, so
>> qgis tries to get the style (AND it's legendgraphic) from the parent
>> layer/node:
>>
>> http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc=GetCapabilities=WMS
>>
>> in this case mapserver's rootnode, which has a legendgraphic with all
>> child symbols...
>>
>> so my fix would be: define a style for the child layer 'rt_ofc.10k54',
>> so I do not think it has something to do with the dot in the naming?
>>
>> Regards,
>>
>> Richard Duivenvoorde
>>
>>
>> On 03-09-16 20:42, aperi2007 wrote:
>>> Hi Richard,
>>>
>>>
>>> I tested also the QGIS 2.8 and the QGIS 2.12 no one of them has this issue.
>>>
Bingo: that is the one we are actually retrieving, the parent node's
>>>
 style and legend.

 So: not sure if that is desired behaviour... at least not for a legend..
>>>
>>> Ok, now is more clear what is happened.
>>>
>>> The "rt_ofc" is the name of all the wms service.
>>> So apply-ing the value "rt_ofc" to the layers parameter mean ask to the
>>> wms server to send the response for ALL the layers available in the
>>> service.
>>>
>>> So the problem more probably is that qgis is failing to parse the
>>> layername stopping it at the dot character.
>>>
>>> The QGIS 2.8 and 2.12 don't fail to parse these wms layersname.
>>> So it is due to some evolution put in the last qgis.
>>>
>>> The "rt_oc" part of the layer name is also the name of all the wms service.
>>>
>>> This will cause to receive the legend of ALL the layers.
>>>
>>> A.
>>>
>>>
>>>
>>> Il 03/09/2016 20:03, Richard Duivenvoorde 

Re: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend

2016-09-16 Thread Lime, Steve D (MNIT)
Hi Andrea: I guess I'm not sure exactly what you're asking. With 
latest/greatest QGIS raster WMS layers (e.g. aerial photos) show up fine in the 
QGIS legend if I have a KEYIMAGE set in the layer object. --Steve

-Original Message-
From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On 
Behalf Of Andrea Peri
Sent: Thursday, September 08, 2016 8:11 AM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Fwd: [Qgis-user] Wrong retrieving of wms legend

Hi post here a response from the qgis-user list about a question on
the GetLegendGraphics.
With the last version of qgis, when try to add in qgis a layer wms of
kind RASTER the qgis retrieve the legend OF ALL the layer available in
the service.
I guess this was a bug. But instead as the qgis guys response me seem
to be a right action.
The question seem that a layer wms should aALWAYS return a style. So
the question I guess is more interesting for the mapserver list:
A WMS LAYER of kind IMAGE (a catalogue of ortophoto as example) should
always have a style ?

(sorry for long thread repost, but I guess is better to post all the
discussion to help understand)

Thx,

Andrea.


2016-09-08 14:45 GMT+02:00 Richard Duivenvoorde :
>
> Hi Andrea,
>
> note that I also added a comment at the code which is reponsible for this:
>
> https://github.com/qgis/QGIS/commit/69bed218373b3f93671f65bc3d02c45cbf683a48#comments
>
> Patrick's response there on this (see comment):
>
> "
> IMHO, there is nothing to fix in QGIS, here. If a layer defines no
> style, it's wanted that it inherits the parent layer's style. Have a
> look at chapter 7.2.4.6.5 of the WMS implementation specification:
>
> Style declarations are inherited by child Layers. A child shall not
> redefine a Style with the same Name as one
> inherited from a parent. A child may define a new Style with a new Name
> that is not available for the parent Layer.
>
> This PR is just a workaround for MapServer that is defining a style
> named default for both the parent and the child layers. This was making
> QGIS show 2 default styles for every child layers. Style inheritance was
> already there before. Now at has just a saner behavior in regard to
> non-standard compliant servers.
>
> I'll let you forward that to the user ML. I was not subscribed to it and
> therefore cannot reply directly to the thread.
> "
>
> So in short: mapserver does not define a style for the actual layer, so
> qgis tries to get the style (AND it's legendgraphic) from the parent
> layer/node:
>
> http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc=GetCapabilities=WMS
>
> in this case mapserver's rootnode, which has a legendgraphic with all
> child symbols...
>
> so my fix would be: define a style for the child layer 'rt_ofc.10k54',
> so I do not think it has something to do with the dot in the naming?
>
> Regards,
>
> Richard Duivenvoorde
>
>
> On 03-09-16 20:42, aperi2007 wrote:
>> Hi Richard,
>>
>>
>> I tested also the QGIS 2.8 and the QGIS 2.12 no one of them has this issue.
>>
>>>Bingo: that is the one we are actually retrieving, the parent node's
>>
>>> style and legend.
>>>
>>> So: not sure if that is desired behaviour... at least not for a legend..
>>
>> Ok, now is more clear what is happened.
>>
>> The "rt_ofc" is the name of all the wms service.
>> So apply-ing the value "rt_ofc" to the layers parameter mean ask to the
>> wms server to send the response for ALL the layers available in the
>> service.
>>
>> So the problem more probably is that qgis is failing to parse the
>> layername stopping it at the dot character.
>>
>> The QGIS 2.8 and 2.12 don't fail to parse these wms layersname.
>> So it is due to some evolution put in the last qgis.
>>
>> The "rt_oc" part of the layer name is also the name of all the wms service.
>>
>> This will cause to receive the legend of ALL the layers.
>>
>> A.
>>
>>
>>
>> Il 03/09/2016 20:03, Richard Duivenvoorde ha scritto:
>>> Ok, at first the problem seemed the dot in the layernames:
>>>
>>> This is the GetMap request QGIS fires off:
>>>
>>> http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc_resolution=91=ita&=WMS=1.3.0=GetMap=1063072.194008157123,5185232.179659257643,1388677.251798849553,5543677.86921980232=EPSG:3857=518=569=rt_ofc.10k54==image/png=96_RESOLUTION=96_OPTIONS=dpi:96=TRUE
>>>
>>>
>>> as you see: LAYERS=rt_ofc.10k54
>>>
>>> This is the GetLegendGraphic url created by QGIS:
>>>
>>> http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc_resolution=91=ita=1.3.0=WMS=GetLegendGraphic_version=1.1.0=rt_ofc=image/png=default&=true
>>>
>>>
>>> NOTE: layer=rt_ofc
>>>
>>> (all seen in the debug info on QGIS on Linux (Debug)):
>>>
>>> Which SHOULD be:
>>>
>>> http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc_resolution=91=ita=1.3.0=WMS=GetLegendGraphic_version=1.1.0=rt_ofc.10k54=image/png=default&=true
>>>
>>>
>>> NOTE, I edited: layer=rt_ofc.10k54
>>>
>>>