Hello Cesium Team,
I was trying to find a way to gather GEOTIFF coordinate data from an uploaded GEOTIFF file to Ion as an asset. It would be used for multiple situations, but one of those would be to fly to the imported asset when imported. This automatically works on Ion , but does not work on CesiumJS automatically.
Hi @Bullshark,
Thanks for your post.
It sounds like you are trying to zoom to a 3D Tileset in CesiumJS created by uploading a GeoTiff to Cesium ion. You can pass a tileset to viewer.zoomTo like below:
const viewer = new Cesium.Viewer("cesiumContainer");
const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(YOUR_ASSET_ID);
viewer.scene.primitives.add(tileset);
viewer.zoomTo(tileset);
Coordinates for a tileset in Cesium will be in 3D cartesian coordinates, but you can convert back to cartographic coordinates like below:
// Assume `cartesian` is a Cesium.Cartesian3 object
const cartesian = new Cesium.Cartesian3(x, y, z);
// Convert to cartographic (radians)
const cartographic = Cesium.Cartographic.fromCartesian(cartesian);
// Convert to degrees
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
const height = cartographic.height;
console.log(`Lat: ${latitude}, Lon: ${longitude}, Height: ${height}`);
Please let us know if this is what you are looking for, we are happy to try and assist more.
Best,
Luke