[Users] legend for OpenLayers.Layer.Image
Charlton Galvarino
charlton at 2creek.com
Thu Sep 23 21:18:21 CEST 2010
> This won't work. "legendUrl" must be set in the layer record, as
> opposed to the layer. For further help please paste your code that
> creates the map, layers, and the MapPanel.
Ah, interesting. This little code snipped doesn't seem to make a difference. It might not make too much sense to pin this on a Store listener, but I thought I could at least test it this way.
var olLayerStore = new GeoExt.data.LayerStore({
map : map
,layers : baseLayer
,listeners : {
add : function(store,rec,index) {
if (rec[0].get('layer').name == 'myImageName') {
rec[0].set('legendUrl','http://myLegendUrl');
}
}
}
});
In any case, I know that I am getting to the set() part of my code when I add my image by firing a dumb alert(), but I still don't see anything in my legend panel.
My map is pretty generic:
map = new OpenLayers.Map('',{
controls : [
new OpenLayers.Control.Navigation()
,new OpenLayers.Control.PanZoomBar()
,mouseControl
]
});
My baseLayer is a normal WMS layer as well. And the addition of other normal WMS-es causes beautiful legends to show up in the panel.
I certainly don't mind posting code, but I was trying to hone in on where I thought the problem might be. Of course, the problem could be sitting here in this chair typing this email!
More information about the Users
mailing list