TilingScheme.positionToTileXY is returning the wrong tile


If I get a rectangle based on on TileXY position and then try to get the position based on that rectangles corner I get the wrong tile. I assume this is because the position is on the edge but I’m not too sure how to get around this.


const wholeWorldtilingScheme = new Cesium.GeographicTilingScheme({

rectangle: Cesium.Rectangle.MAX_VALUE


const aPoint = new Cartographic(2.321256314692997, -0.5235673596717629);

const aTile = wholeWorldtilingScheme.positionToTileXY(upperLeftPoint, 10); // returns x: 1780 y: 682

const aRectangle = wholeWorldtilingScheme.tileXYToRectangle(aTile .x, aTile .y, 10); // returns {west: 2.319378951283089, south: -0.5246214294568894, east: 2.3224469128588607, north: -0.5215534678811178}

… //later

const upperLeftOfaRectangle = new Cesium.Cartographic(aRectangle.west, aRectangle.east);

const tryToGetBackToTilePosition = wholeWorldtilingScheme.positionToTileXY(upperLeftOfaRectangle, 10); // returns x: 1780 y: 681

Do you have any suggestions on how to eliminate this error?


Sunny Little