How do I convert XY terrain tiles to latitude/longitude values?

A concise explanation of the problem you’re experiencing.

The problem I’m experiencing is that when I convert XY values to lat/long values, the returned values are massively incorrect.

I’ve tried using the code from the link below to do the conversion, which resulted in large discrepancies from where they should be. I’ve also tried using the built in Cesium functions in the GeographicTilingScheme class, which also returned incorrect values. I thought it might be because the default number of root tiles in each direction was incorrect, since the default for numberOfLevelZeroTilesX is 2 and my tileset only has 1, so I changed that and still received incorrect values.

I’ve attached the layer.json file with the XY values I’m trying to use.

An example of the Python code I tried:

num2deg(57687, 10821, 15)

(52.01869808104434, 453.768310546875)

Context. Why do you need to do this? We might know a better way to accomplish your goal.

I’m trying to find the rectangle of a certain zoom level in Cesium so that I can automatically zoom to the location of the terrain

layer.json (1.83 KB)

The XYZ values in the quantized mesh values are in ECEF coordinates, which is the same coordinate system that CesiumJS uses. So you should be able to use them directly if your goal is to place something at that location in your Cesium application.

Are you referring to the XYZ coordinates found in the quantized mesh tile header? I’m trying to calculate the bounding rectangle of a terrain file at a specified zoom level using the availability data in the layer.json file.

If I wanted to do that with the tile headers, I’d have to fetch all the tiles for that zoom level, unzip the file and calculate the bounding rectangle, which seems unnecessary to do when it should be possible with the layer.json file.