0

I'm testing OpenLayers 6 beta. ol.inherits looks missing in OpenLayers 6.

ol.inherits(ol.source.NowMap, ol.source.OSM);

This causes error

Uncaught TypeError: ol.inherits is not a function

What should I use instead?

1

It's mentioned in the update notes https://github.com/openlayers/openlayers/blob/master/changelog/upgrade-notes.md

A simple fix which the ol-ext library uses is to replace it with the something based on the old function

var ol_ext_inherits = function(child,parent) {
  child.prototype = Object.create(parent.prototype);
  child.prototype.constructor = child;
};

or see the OL6 examples for a method which will need some recoding https://openlayers.org/en/master/examples/custom-controls.html https://openlayers.org/en/master/examples/custom-interactions.html

  • Thank you very much! – kochizufan Jun 3 at 1:04

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.