Closed (fixed)
Project:
Openlayers
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
8 Mar 2010 at 17:31 UTC
Updated:
8 Apr 2010 at 14:40 UTC
The layer name (machine name) is displayed in layer switcher, when the layer title (human readable) should be displayed.
Comments
Comment #1
Will White commentedChanged affected version.
Comment #2
zzolo commentedFixed: http://drupal.org/cvs?commit=339820
The value passed to the layer functions was the array index, not the layer title.
Comment #3
tmcw commentedThis breaks some functionality: there's a gotcha here, in that the old style layer names were used to reference layers (in the ZoomToLayer behavior, for example), sot his change broke them. But this change is also somewhat necessary, because we want nice things in layer switchers. But 'fixing' zoomtolayer is not enough, because this change prevents us from having unique identifiers for layers. There needs to be some kind of fix here.
Comment #4
zzolo commentedAh, because the name that you give the layer when you create it in OpenLayers is the name to reference it by? Hmmm. Yeah, we definitely need the more-friendly display.
How about this? Can we add the layer name (unique identifier) to the layer object when we create it?
Comment #5
tmcw commentedThis is likely another regression caused by this change: http://drupal.org/node/749054
Comment #6
zzolo commentedI will work on this tonight. I'd rather get through this issue that revert it.
Comment #7
tmcw commentedProbably the best solution is to add an id parameter to the layer init code and then use the map object's getLayersBy method whenever we need to select a layer by this id.
Comment #8
zzolo commentedhttp://drupal.org/cvs?commit=345038
I have tested this to the best of my ability and appreciate any other eyes on it. Closing related tickets as well.
The addLayers function, now adds a
drupalIDproperty to the options array which gets inserted in the actual Layer itself. So this is now the way to reference the layer. You could use a function like this to get the layer, given openlayers is your map object (which btw is kind of confusing)I have also updated each layer handler function to use this change for style maps, and I also change the fir argument in this function to be title since it is a better description on what it is (name is the property that the Layer uses). Example.
Updated default base layer code. Though I am curious as why this:
Couldnt be this. I tried to get it to work but to no avail.
* Updated views layer handler
* Updated zoomtolayer
* Updated CCK behaviors with IDs, though this should have been working fine before, as there was no need for IDs.
Comment #9
tmcw commentedI would assume that getLayersBy always returns an array, and setBaseLayer expects a single layer.