Skip to content

Commit

Permalink
add VectorTileSource#setData for dynamic vector tiles rendering map…
Browse files Browse the repository at this point in the history
  • Loading branch information
stepankuzmin committed Jan 12, 2020
1 parent 90dbfec commit c6c695b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/source/vector_tile_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,23 @@ class VectorTileSource extends Evented implements Source {
this.load();
}

setData(options: VectorSourceSpecification & {collectResourceTiming: boolean}) {
if (this._tileJSONRequest) {
this._tileJSONRequest.cancel();
}

extend(this, pick(options, ['url', 'scheme', 'tileSize']));
this._options = extend({ type: 'vector' }, options);

this._collectResourceTiming = options.collectResourceTiming;

if (this.tileSize !== 512) {
throw new Error('vector tile sources must have a tileSize of 512');
}

this.load();
}

onRemove() {
if (this._tileJSONRequest) {
this._tileJSONRequest.cancel();
Expand Down

0 comments on commit c6c695b

Please sign in to comment.