You're specifying it as a param not an option, so use the 4th argument of the Layer.WMS constructor instead. To avoid name clashes use something like layerId instead.
Bart Sent from my iPhone On Jan 6, 2011, at 6:06 PM, elshae <[email protected]> wrote: > > Dear OpenLayers Users, > > I know this sounds like a silly question to ask, but I am unable to get the > ID of a layer. Going more into specifics, I want to get the ID of the layer > using the layer object itself. I am using the ExtJS and GeoExtJS libraries > and have trees with nodes that correspond to the layer. > > If I call node.layer.id on any given layer I get back the layer's DIV ID, > something like: > OpenLayers.Layer.WMS_97 > > instead the layer ID I configure in the layer's constructor as so: > > var someLayer = new OpenLayers.Layer.WMS( > "myLayer", "http://localhost:8080/geoserver/wms", > {id: "someLayer", layers: 'cite:layer,transparent: > true}, {isBaseLayer: false, displayInLayerSwitcher: true, > visibility: true, minScale: 27734017.045258757} > ); > > I've also tried using node.layer which seems to return the layer object > itself and have also tried layer = map.getLayersByName(node.layer.name); > which also gives me the layer object, but then am at a lost what to do with > that object to get it's ID... > > Something like layer.getLayerId() would really help me..If anyone knows of > anything similar that I can use on a layer object to obtain it's ID or by > using the map object with the layer name to get that layer's ID, I greatly > appreciate it :) > > Thank you, > > elshae > -- > View this message in context: > http://osgeo-org.1803224.n2.nabble.com/Get-A-Layer-s-ID-tp5896290p5896290.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users > _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
