Search code examples
javascriptopenlayers

OpenLayers.Control.Scale.template - how does it work and does it work at all?


The OpenLayers2 Doc here http://dev.openlayers.org/docs/files/OpenLayers/Control/Scale-js.html#OpenLayers.Control.Scale.template says Openlayers.Control.Scale has a Property called "template". As far as i understood i tried to set it like:

            new OpenLayers.Control.Scale('nodelist',
                { template: 'ca. 1: ${scaleDenom}' }
            )

but it seems to have no effect at all. The actual Scale-Control shown in the resulting div-Element remains defaultish as if it (if its set at all) is overridden.

So what would be the proper way to use Openlayers.Control.Scale.template Property or what is it for?


Solution

  • One close look into the OpenLayers 2.13 library itself revealed that the documentation is somehow malicous because there is no way to set something like a template property using the OpenLayers.Control.Scale constructor.

    Though its possible to override the Scale class and use the modified one like an ordinary control.

    Sorry for answering my own Question but it sure helps someone out there :)