Handle tile coordinate wrapping when reprojecting raster tiles

This commit is contained in:
Petr Sloup
2015-12-11 13:27:57 +01:00
parent c4237c7858
commit 9f5d85f2c6
4 changed files with 27 additions and 16 deletions
+5 -2
View File
@@ -204,17 +204,20 @@ ol.source.TileImage.prototype.getTile =
return this.getTileInternal(z, x, y, pixelRatio, projection);
} else {
var cache = this.getTileCacheForProjection(projection);
var tileCoordKey = this.getKeyZXY(z, x, y);
var tileCoord = [z, x, y];
var tileCoordKey = this.getKeyZXY.apply(this, tileCoord);
if (cache.containsKey(tileCoordKey)) {
return /** @type {!ol.Tile} */ (cache.get(tileCoordKey));
} else {
var sourceProjection = this.getProjection();
var sourceTileGrid = this.getTileGridForProjection(sourceProjection);
var targetTileGrid = this.getTileGridForProjection(projection);
var wrappedTileCoord =
this.getTileCoordForTileUrlFunction(tileCoord, projection);
var tile = new ol.reproj.Tile(
sourceProjection, sourceTileGrid,
projection, targetTileGrid,
z, x, y, this.getTilePixelRatio(),
tileCoord, wrappedTileCoord, this.getTilePixelRatio(),
goog.bind(function(z, x, y, pixelRatio) {
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
}, this), this.reprojectionErrorThreshold_,