[OpenLayers-Users] extending ol.Tile in OpenLayers 6?

Ashley Mort ashley_c_mort at raytheon.com
Thu Oct 1 19:31:42 PDT 2020


I am upgrading my app from OpenLayers 4.6.4 to 6.1.1 and I can't figure out how to extend Tile in OL6. My code is as follows which works in OL 4.6.4.  What would I do to achieve the same thing in OpenLayers 6?

My error is: Uncaught TypeError: Class extends value undefined is not a constructor or null

index.html that includes OL6.1.1 is:

<link rel="stylesheet" href="ol.css">

<script src="ol.js"></script>



<div tabindex="700" id="map" class="map"></div>



<script type="module">

    import MapView from './mapview.js';



    var mv = new MapView();

</script>



My map view class contains the following (which works in OpenLayers 4):

class CanvasTile extends ol.Tile {

  constructor(tileCoord, state, src, crossOrigin, tileLoadFunction, options) {

    super(tileCoord, state, options);

    this.canvas = document.createElement('canvas');

    this.tileLoadFunction = tileLoadFunction;

    this.src = src;

  }



  getCanvas() {

    return this.canvas;

  }

}


Ashley Mort
Sr. Software Engineer
972-638-6317 office
814-571-3039 cell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20201002/1025e5f4/attachment-0001.html>


More information about the Users mailing list