Ok, I got it! But following this example, the mapPanel object has to be
declared, before we can update the legendURL with:
mapPanel.layers.getAt(x).set("legendURL", "..."). I've tried this, that's
perfect.
But is there a trick to declare this legendURL at the same time than the
OpenLayers.Layer.WMS? Otherwise, I should do some queries to find the good
index in layers for each layer that needs legend. The problem is that it's not
an OL attribute...
I tried something that works, but maybe there is a better solution: when
needed, I add a legendURL attribute in OL.Layer.WMS configuration. Once all the
OL layers and the GeoExt mapPanel are declared, a for loop creates the proper
legendURL for GeoExt configuration:
var lyrNb = mapPanel.layers.getCount();
for (i=0; i<lyrNb; i++) {
var lyr = mapPanel.layers.getAt(i);
lyr.set("legendURL", lyr.data.layer.legendURL)
}
This way, WPS layers do have this legendURL parameter for GeoExt, and other
regular WMS layers do not change.
Gabriel
----- Mail original -----
De: "Andreas Hocevar" <[email protected]>
À: "Gabriel Vatin" <[email protected]>
Cc: "geoserver" <[email protected]>, "Xavier Chaze"
<[email protected]>
Envoyé: Jeudi 25 Avril 2013 16:36:47
Objet: Re: [Geoserver-users] WPS legend within GeoExt LegendPanel
The legend graphic comes from a WMS GetLegendGraphic request by
default. This won't work for your WPS layers. You will have to add a
legendURL field to the layer records of your WPS layers. See the
http://api.geoext.org/1.1/examples/legendpanel.html and investigate
the 'legendurl' button to see how this is done.
Andreas.
On Thu, Apr 25, 2013 at 2:15 PM, Gabriel Vatin
<[email protected]> wrote:
> Hi all,
>
> I am having some issues with using GeoExt, OpenLayers + GeoServer, when it
> comes to the legend and WPS.
>
> Here are some WMS layers I tried to display on a map and within a GeoExt
> LegendPanel : "Cities" (points, works great), "CoastLine" (line, works
> great), "ZST Gibraltar" (polygon, works great), "Timezones" (polygon with
> GeoServer SLD for colors, works still great).
>
> No, some layers that have a few problems :
> "TSE Gibraltar" (2 GS layers that are integrated on server side, requested as
> one layer with OpenLayers) is displayed, but no legend. I think it's because
> it's agregation of layers, so no real SLD.
> "Waves speed" (1 GS layer of points with WPS for interpolation, makes an
> "area" layer), here again the layer is displayed well, but no legend.
>
> I tried basic GetLegendGraphic for these two layers, I do have good legend
> for WPS layer, but none of course for agregated layers.
>
> All these layers are requested with OpenLayers as OpenLayers.Layer.WMS, with
> same configuration. GeoExt LegendPanel is configured so :
>
> legendPanel = new GeoExt.LegendPanel({
> defaults: {
> labelCls: 'mylabel',
> style: 'padding:5px'
> },
> bodyStyle: 'padding:5px',
> width: 350,
> autoScroll: true,
> region: 'west'
> });
>
> Do you have any idea how to display the legend for WPS processed images?
> Thanks for the help !
>
> Regards,
>
>
> Gabriel Vatin
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users