[OpenLayers-Dev] Lost scope in tileUrlFunction when extending ol.source.VectorTile (MVT)
Christian Mayer
ml-cm at meggsimum.de
Thu Oct 12 04:45:42 PDT 2017
Hi all,
I extended the class ol.source.VectorTile in order to load VectorTiles
in different formats (GeoJSON and MVT) from a local GWC cache. While
upgrading from OpenLayers v3.20 to OpenLayers v4.x it seems that for MVT
the scope in the "tileUrlFunction" gets lost. It seems to be "window".
For GeoJSON-based VectorTiles everything is still running fine.
Below you find the crutial parts of my class:
ol.inherits(ol.source.GWCVT, ol.source.VectorTile);
ol.source.GWCVT.prototype.tileUrlFunction =
function(tileCoord, pixelRatio, projection) {
// here 'this' becomes 'window' in the second call
// assembling the URL
// ...
}
ol.source.GWCVT.prototype.setTileUrlFunction = function(tileUrlFunction) {
ol.source.VectorTile.prototype.setTileUrlFunction.call(this,
tileUrlFunction);
};
Thanks for any hint!
Cheers
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20171012/0615eb38/attachment.html>
More information about the Dev
mailing list