From 08e0a0dfea75b5dcf1efbedefdbd5b95169fc526 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 5 Jun 2018 16:38:15 +0200 Subject: [PATCH] Fix vector tile docs and types --- src/ol/VectorTile.js | 2 +- src/ol/source/VectorTile.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ol/VectorTile.js b/src/ol/VectorTile.js index 119ddf49ac..f44d381803 100644 --- a/src/ol/VectorTile.js +++ b/src/ol/VectorTile.js @@ -59,7 +59,7 @@ const VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt * @private * @type {module:ol/proj/Projection} */ - this.projection_; + this.projection_ = null; /** * @private diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js index 20d83a4a88..6ee376c2cf 100644 --- a/src/ol/source/VectorTile.js +++ b/src/ol/source/VectorTile.js @@ -31,11 +31,13 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid. * tile.setLoader(function() { * var data = // ... fetch data * var format = tile.getFormat(); + * tile.setProjection(format.readProjection(data)); * tile.setFeatures(format.readFeatures(data, { - * // uncomment the line below for ol/format/MVT only - * extent: tile.getExtent(), + * // featureProjection is not required for ol/format/MVT * featureProjection: map.getView().getProjection() * })); + * // the line below is only required for ol/format/MVT + * tile.setExtent(format.getLastExtent()); * }; * }); * @property {module:ol/Tile~UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.