[Users] problem using 'legendURL'
Bart van den Eijnden (OSGIS)
bartvde at osgis.nl
Wed Nov 24 08:45:09 CET 2010
Hi,
you need to set the legendURL not on the OpenLayers Layer object, but on
the GeoExt LayerRecord.
So look up the corresponding record in the layerstore (using e.g.
findByLayer), and use:
record.set("legendURL", "http://foo");
Best regards,
Bart
> Hi all,
>
> I added a legend-panel to my OL page and that works great for all legends
> that are vector based WMS layers. I also added multiple TileCache layers
> to the map panel. For those I added legendURL parameters to define how the
> legend should look in the legendPanel . The legend url is a link to a
> static png image. However, whatever I try I am running into problems that
> the legend for the TileCache layers does not show up.
> What is the proper and easiest way to define the legenurls for the two
> layers I have been using and to use the png images I already have... see
> below
>
> My latest attempt was just to define the legenurl as a parameter see below
> but that does not work ....
>
> var publiclands = new OpenLayers.Layer.WMS("Public Lands",
> "/tilecache/tilecache.py", {layers: 'calipc_public_lands', 'transparent':
> true, 'legendURL': 'http://myurl.net/legend/publiclands_legend.png'},
> {isBaseLayer: false, 'opacity': 0.6, 'visibility': true} );
>
> var watersheds = new
> OpenLayers.Layer.WMS("Watersheds","/tilecache/tilecache.py", {layers:
> 'calipc_watersheds', 'transparent': true, 'legendURL':
> ''http://myurl.net/legend/watersheds_legend.png'}, {isBaseLayer: false,
> 'opacity': 1, 'visibility': true} );
>
> my layerstore looks like this
>
> var legendLayerStore = new GeoExt.data.LayerStore({
> map: map,
> layers: [publiclands,watersheds,quads,counties]
> });
>
> (quads and counties legend is working)
>
> and
> legendPanel = new GeoExt.LegendPanel({
> title: 'legend',
> collapsed : false,
> collapsible : true,
> defaults: {
> labelCls: 'mylabel',
> style: 'padding:5px'
> },
> bodyStyle: 'padding:5px',
> // width: 350,
> autoScroll: true,
> layerStore: legendLayerStore
> })
>
> I know that the 'legendURL' parameter is capitalized by OL , but I am not
> sure that is the problem that this is not working for me. If this is not
> the correct approach how can it be done ?
>
> Thanks
> Karsten
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
More information about the Users
mailing list