[OpenLayers-Dev] Lost scope in tileUrlFunction when extending ol.source.VectorTile (MVT)
Christian Mayer
ml-cm at meggsimum.de
Thu Oct 12 05:33:47 PDT 2017
Hi again,
here is some more information in addition to my previous mail:
The problem occurs for VectorTiles in GeoJSON format as well. So there
must be a more general problem with extending the
ol.source.VectorTile (or the way I do it).
The change / problem seems to be introduced with Version 4.2.0. With
version 4.1.1 everything works as expected.
Cheers
Chris
On 12.10.2017 13:45, Christian Mayer wrote:
>
> 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
>
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/openlayers-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20171012/165e0743/attachment.html>
More information about the Dev
mailing list