Add functionality to create tilesets for S2 cells#202
Conversation
|
The last commit adds a CLI command for the S2 tileset creation. There are quite a few configuration options for the resulting tileset. These could be routed through the command line, but at a certain number, it would probably make more sense to summarize them in some plain JSON file, and pass in that file as some For now, only a few options are offered at the command line, namely the ones that I considered to be the most important ones:
For example: This will create tileset JSONs for the S2 cells up to level 7, with the leaf tiles having content URIs like (An aside: The Specs still have to be added. |
This PR currently adds two classes that can be used for creating tilesets based on the S2 cell hierarchy, with contents that are identified by S2 cell tokens.
The
TilesetJsonCreatorS2class offers a function to create theTilesetobject. The structure of this tileset will be:roothas 6 children, one for each S2 face IDFor example, for 2 S2 levels, the output will look as follows:
{ "asset": { "version": "1.1" }, "extensionsRequired": [ "3DTILES_bounding_volume_S2" ], "extensionsUsed": [ "3DTILES_bounding_volume_S2" ], "geometricError": 1048576, "root": { "refine": "ADD", "boundingVolume": { "region": [ -3.141592653589793, -1.5707963267948966, 3.141592653589793, 1.5707963267948966, -12000, -9000 ] }, "geometricError": 524288, "children": [ { "geometricError": 524288, "boundingVolume": { "extensions": { "3DTILES_bounding_volume_S2": { "token": "1", "minimumHeight": -12000, "maximumHeight": -9000 } } }, "children": [ { "geometricError": 524288, "boundingVolume": { "extensions": { "3DTILES_bounding_volume_S2": { "token": "04", "minimumHeight": -12000, "maximumHeight": -9000 } } }, "children": [ { "geometricError": 262144, "boundingVolume": { "extensions": { "3DTILES_bounding_volume_S2": { "token": "01", "minimumHeight": -12000, "maximumHeight": -9000 } } }, "content": { "uri": "content-01" } },The
contentURI is configurable with a template URI.For a larger number of S2 levels, that tileset will grow quickly. For example, for 7 S2 levels, the resulting tileset JSON will have roughly 100MB.
I therefore added another class here, which was on my "implicit TODO list" for quite a while now anyhow: The
TilesetSplitterclass receieves a tileset, and converts individual tiles into external tilesets.The criterion for converting a tile into an external tileset is pretty generic internally. But externally (on the API level), it can currently only be configured by defining the "global" levels on which a split should occur.
This
TilesetSplittercan then be applied to the tileset that is generated for the S2 cells. The following snippet illustrates that:This will generate the tileset with 7 S2 levels, split it at level 4, and write out the results. The results will then be..
external-00c.json, which each have 170KB