How to understand layer.json in terrain services?

Some of the content is shown below

  "available": [
    [
      {
        "endX": 21,
        "endY": 31,
        "startX": 0,
        "startY": 0
      },
      {
        "endX": 42,
        "endY": 5,
        "startX": 22,
        "startY": 0
      },
      {
        "endX": 63,
        "endY": 31,
        "startX": 49,
        "startY": 5
      },
      {
        "endX": 63,
        "endY": 4,
        "startX": 43,
        "startY": 0
      },
      {
        "endX": 48,
        "endY": 5,
        "startX": 43,
        "startY": 5
      },
      {
        "endX": 48,
        "endY": 31,
        "startX": 22,
        "startY": 6
      }
    ],

What do the X and Y coordinates in the content represent?

Does it represent the X and Y coordinates in TilingScheme?

Hey @SAYEOR, thanks for the question. Kevin provided an explanation of the available property in response to another question here.

Take this abbreviated example:

{
    // rest of layer.json omitted

    "tiles": ["{z}/{x}/{y}.terrain?v={version}"],
    "available": [
        [
            {
                "startX": 0,
                "startY": 0,
                "endX": 32,
                "endY": 32
            }
        ],
        [
            {
                "startX": 64,
                "startY": 32,
                "endX": 128,
                "endY": 64
            }
        ]
    ]
}

Here, we’re telling Cesium that there’s two layers available, layer 0 and layer 1. The first element of the array defines the range of indices for layer 0, telling it that the tiles it needs for that layer can be found between 0/0/0.terrain and 0/32/32.terrain. Layer 1 says that the tiles are located between 64-128 on the X index and 32-64 on the Y index. This means that Cesium will make requests for tiles for layer 1 between 1/64/32.terrain and 1/128/64.terrain.

I hope this helps clear things up!

1 Like

Thanks @azrogers :wink:

1 Like