Correctly generate child tile ranges for XYZ
Instead of incrementing and then doubling, calculate the child tile range by doubling and then incrementing.
With this change, tile coord [0, 0, 0] has the four following children:
[1, 0, 0] [1, 1, 0]
[1, 0, 1] [1, 1, 1]
Without this change, tile coord [0, 0, 0] had the nine following children:
[1, 0, 0] [1, 1, 0] [1, 2, 0]
[1, 0, 1] [1, 1, 1] [1, 2, 1]
[1, 0, 2] [1, 1, 2] [1, 2, 2]
This commit is contained in:
@@ -100,9 +100,11 @@ ol.tilegrid.XYZ.prototype.createTileCoordTransform = function(opt_options) {
|
||||
ol.tilegrid.XYZ.prototype.getTileCoordChildTileRange =
|
||||
function(tileCoord, opt_tileRange) {
|
||||
if (tileCoord[0] < this.maxZoom) {
|
||||
var doubleX = 2 * tileCoord[1];
|
||||
var doubleY = 2 * tileCoord[2];
|
||||
return ol.TileRange.createOrUpdate(
|
||||
2 * tileCoord[1], 2 * (tileCoord[1] + 1),
|
||||
2 * tileCoord[2], 2 * (tileCoord[2] + 1),
|
||||
doubleX, doubleX + 1,
|
||||
doubleY, doubleY + 1,
|
||||
opt_tileRange);
|
||||
} else {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user