[Users] problem using 'legendURL'

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Wed Nov 24 09:33:39 CET 2010


Hmm, strangely enough it is not in the API docs [1], however in
GeoExt/data/LayerStore.js:

        /** public: method[getByLayer]
         *  :param layer: ``OpenLayers.Layer``
         *  :return: :class:`GeoExt.data.LayerRecord` or undefined if not
found
         *
         *  Get the record for the specified layer
         */
        getByLayer: function(layer) {
            var index = this.findBy(function(r) {
                return r.get("layer") === layer;
            });
            if(index > -1) {
                return this.getAt(index);
            }
        },

[1] http://api.geoext.org/1.0/docs/lib/GeoExt/data/LayerStore.html

Best regards,
Bart

> Thanks I'll try that. However, I can not find any reference to a method
> for
> function "findByLayer" or something similar in the GeoEXT docs to be able
> to
> retrieve the record in the layerstore...
> Any hints ?
>
> Karsten
>
>> -----Original Message-----
>> From: Bart van den Eijnden (OSGIS) [mailto:bartvde at osgis.nl]
>> Sent: Tuesday, November 23, 2010 23:45
>> To: karsten vennemann
>> Cc: users at geoext.org
>> Subject: Re: [Users] problem using 'legendURL'
>>
>> 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