Disclaimer
This is not a Cesium product.
(Despite that “Cesium Team” label)
It is a spare-time project, published as “Public Domain”, in the hope that people find it useful.
It is provided “as is”, without warranty of any kind.
But if it doesn’t work as expected, feel free to point it out…
What it is
It is a sandcastle that allows editing the location of a tileset. Specifically, it allows setting the rotation, translation, and scaling factors of a tileset. It also allows applying a “geo-transform” to the tileset, based on longitude, latitude, and height. The resulting transforms can be written out in a form that allows applying the transform to the tileset at runtime (when it is loaded in another sandcastle), or directly in the tileset JSON:
Here is a screenshot with a short summary:
- At the top of the control panel, different “Samples” can be selected.
- For now, this is only one of the photogrammetry examples and an iTwin model, or a tileset that is loaded from localhost.
- The buttons in the control panel have the following functions:
- The “Zoom” button will center the view on the current tileset.
- The “Print code” button will print code to the console (as shown in the image). This is the code that has to be inserted into a sandcastle, to apply the selected transform to this tileset.
- The “Print transform” button will print the JSON to the console that has to be inserted as the
root.transformof a tileset JSON, to place the tileset at the selected position
- The “Geo-placement” section:
- It allows selecting a longitude/latitude/height at which the tileset should be placed
- This geo-placement can be enabled with a checkbox. If this is disabled, only the local transform applies
- The “Local transform” section:
- This offers controls for the translation, rotation, and scaling of the tileset
Here is a short screencap:

Why this could be useful
When uploading data to Cesium ion, there is a dedicated functionality to Set Location For data Uploaded to Cesium ion. But that “3D Tiles Location Editor” can not be used for all tilesets, and there are some open questions about its scope and usage.
The question about how to edit the location of a tileset came up many times in the forum. (Example threads: 27554, 34230, 37267, 39010, and many more). I responded in many of these threads, and collected a set of snippets for the specific cases.
I now tried to consolidate this, and offer it as a convenient editor in a Sandcastle, including the necessary functions to write out the code or JSON that is required for applying the actual location to a tileset.
How it is implemented
The actual functionality of the Tileset Location Editor is encapsulated in a class called TilesetLocationEditor. That seemed to make sense
The caller can assign a tileset to such an editor. And then, the editing functions of the editor can be called:
setTranslation,setRotation, andsetScaleto set the local translation, rotation, and scalingsetGeoTransformto set a geo-transform with longitude, latitude, and heightsetApplyingGeoPlacementto decide whether the geo-placement should be applied
The other functions are “private”. Most of the work is done in computeTilesetModelMatrix, which … computes the tileset model matrix based on the translation, rotation, scale, and geo-placement. This function contains some comments that explain the computations that are taking place.
Most of the remaining part of the Sandcastle code is just setting up the Sandcastle UI, and wiring it into the editor. The sandcastle UI and its KnockoutJS-“View-Model” is still completely separate from the actual Tileset Location Editor, so that the editor class itself is “standalone” and can be used in other contexts.
What its limitations are
There are many different ways of how the position and orientation of a tileset could be represented in the data (some of them are listed in this issue). I tried to make the Tileset Location Editor universally applicable to different kinds of tilesets, with different representations of their position and orientation. But 1. this necessarily involves some guesses and assumptions, and 2. there may be cases where the Tileset Location Editor can not be applied or does not behave as expected. However, it should work for the majority of tilesets that are created by Cesium ion or other tools.
The Tileset Location Editor
Here is the Sandcastle showing the Tileset Location Editor
(I might update this link in the future, or add new posts to this thread with updated states)
