smas1 / geoext-viewer

Automatically exported from code.google.com/p/geoext-viewer
GNU General Public License v3.0
0 stars 0 forks source link

LayerLegendPanel: fetch legendURL via Capabilities for some WMS-types #367

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is a backport from the PDOK PreviewApp:

In some non-compliant WMS-es most notably Arcgis and DINO (TNO) services, the 
standard 'GetLegendGraphic' does not work. In those cases the legendURL needs 
to be extracted from a GetCapabilities document. Possibly the one in the first 
Style.

The LayerLegendPanel in the PDOK PreviewApp has some special checks for DINO 
(TNO) services. This feature may be useful to also get legends from some 
Arcgis-based WMS-es. Some generalization, via Heron config is required:

- configure service names e.g. those containing 'dino' or 'arcgis' to get 
legend URL via caps

testing, try example:

http://lib.heron-mc.org/heron/latest/examples/defaultnl

- enable layers with name TNO* 
- see if legend appears

Original issue reported on code.google.com by jus...@gmail.com on 28 Apr 2014 at 11:18

GoogleCodeExporter commented 9 years ago
Work done:

- global component data/OWSCapabilitiesCache.js for fetching and caching OWS 
Capabilities added. Also handy for other components
- updated LayerLegendPanel now loads from capabilities for preconfigured URL 
patterns (e.g. ['dino', 'arcgis'])

tested ok with 
http://lib.heron-mc.org/heron/latest/examples/defaultnl (enable TNO layers and 
see that Legend fetched form WMS Capabilities appears!)

Some more testing but close to Ready...

COnfig for LayerLegendPanel update:

    /** api: config[legendFromCapabilities]
     *  Always get legend URL from Capabilities document i.s.o. via WMS GetLegendGraphic.
     *  default value is false.
     */
    legendFromCapabilities: false,

    /** api: config[legendFromCapabilities]
     *  Get legend URL from Capabilities document i.s.o. via WMS GetLegendGraphic
     *  for these server URL substrings. Some WMS's do not support GetLegendGraphic or have
     *  pre-configured elaborate Legend images. In those cases the Capabilities document
     *  provides a legend URL in the Style section for a Layer.
     *  Type is String array.
     *  default value is ['dino'].
     */
    legendFromCapabilitiesPatterns: ['dino'],

so even can be enabled unconditionally via legendFromCapabilities: true, but 
use with care!.

Original comment by jus...@gmail.com on 1 May 2014 at 5:20

GoogleCodeExporter commented 9 years ago
Done, bugs/enhancements in new issues...

Original comment by jus...@gmail.com on 8 May 2014 at 11:21