0

I have recently started working with OL3 and now I try to add ScaleLine control to my map

var scaleLineControl = new ol.control.ScaleLine({units:'metric'});
var scaleLine = ol.control.defaults({
    attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
    collapsible: false
    })
}).extend([
    scaleLineControl
]);
map.addControl(scaleLine);

When doing this I get the AssertionError: Assertion failed in Firefox

Im using proj4 and the map is using a different projection.

Isnt it possible to use scaleline with other that EPSG:4326 ?

Br Mike

1

Just create the control and add it to the map using addControl. You do not need to use ol.control.defaults.

  • Have you managed to get that work for you? Because for me it doesn't help if i just do: var scaleLineControl = new ol.control.ScaleLine({units:'m'}); map.addControl(scaleLineControl); I still get AssertionError: Assertion failed – Mike001 Sep 23 '14 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.