Skip to content

Specification of the JSON structure#19

Merged
lilleyse merged 6 commits into
mainfrom
layer-json-specification
May 19, 2026
Merged

Specification of the JSON structure#19
lilleyse merged 6 commits into
mainfrom
layer-json-specification

Conversation

@javagl
Copy link
Copy Markdown
Contributor

@javagl javagl commented Mar 24, 2026

Fixes #15 , which has been open in one of my tabs for 5 years, and accumulated 10 👍 's in the meantime.

This is a first attempt to add a proper specification of the layer.json structure. As discussed in the issue, people have largely been reverse-engineering this information from the implementation. This is error-prone and involves too many guesses and assumptions.

The current state of this PR is certainly still not perfect in that regard. It only contains what I could derive from the implementation, links that had been posted in the issue, and the discussion that happened there. But maybe it is a reasonable first step for a proper specification.

Tagging some people who participated in the issue dicussion:

@lilleyse
@kring (the schema here is largely copied from https://github.com/CesiumGS/cesium-native/blob/a42b513f05de5d2700ca1394985a622bca164184/CesiumQuantizedMeshTerrain/schema/layer.schema.json )
@gkjohnson

Copy link
Copy Markdown

@gkjohnson gkjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thanks for adding it.

I would also include a section discussing what to do regarding tile gaps. If "parentUrl" plays a role in filling those that would be good to call out but I know Cesium and 3DTilesRendererJS also split the parent tile into quadrants to fill gaps if only a portion of the more detailed child tiles are available.

Comment thread SPECIFICATION.md Outdated
| scheme | `string` | The tiling scheme. The only valid value is `"tms"`. | No. Default: `"tms"` |
| extensions | `string[]` | The extensions available for this tileset. | No. Default: `undefined` |
| projection | `string` | The map projection of this tileset. Valid values are `"EPSG:4326"` and `"EPSG:3857"`. | No. Default: `"EPSG:4326"` |
| parentUrl | `string` | The URL of the parent layer.json that this one is layered on top of. | No. Default: `undefined` |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expand on what "parentUrl" means here. I assume this may just be being used to fill out tile gaps in the current layer.json?

Also is this used frequently? It's not supported in 3d tiles renderer at the moment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parentUrl description was taken from the schema. You asked about that in an issue comment as well, but no response so far. I had a look at the layer.json from Cesium World Terrain. It wasn't used there. I'll try to reverse engineer where and how this is used in CesiumJS/native. Sure, that's not ideal and time-consuming, but ... it's better when one person is doing it once and writing it up in an "agreed upon" form, than dozens of people spending time with that (and in the worst case, coming to different conclusions...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some archeology led to CesiumGS/cesium#5864 , and I did a bit of browsing in the code and debugstepping through the respective spec, but where exactly things are happening is everything but obvious - you know, that parentUrl is used at the bottom of an undocumented 250-line-function, to assign some properties to some objects... So what can be written in this "specification" is only a (somewhat shallow) attempt of describing the effect (which was derived from what the specs are spec'ing), and I added this in 3aa870a now.

@lilleyse
Copy link
Copy Markdown
Contributor

I would also include a section discussing what to do regarding tile gaps. If "parentUrl" plays a role in filling those that would be good to call out but I know Cesium and 3DTilesRendererJS also split the parent tile into quadrants to fill gaps if only a portion of the more detailed child tiles are available.

@javagl would you mind adding a section about this? Both the "parentUrl" behavior and the "upsampling" approach when refining to unavailable children. Should probably be non-normative since there may be other approaches for hole filling (like fill tiles in CesiumJS).

@javagl
Copy link
Copy Markdown
Contributor Author

javagl commented May 19, 2026

@lilleyse I added a short implementation note about the traversal process and "gaps/fill tiles".

@lilleyse
Copy link
Copy Markdown
Contributor

Thanks @javagl

@gkjohnson
Copy link
Copy Markdown

Thanks again for adding this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specify the JSON structure

3 participants