Finding nearest tie point in Bentley Context Capture from a point clicked on Cesium 3D model

1. A concise explanation of the problem you’re experiencing.

Right now I have a 3D tileset that is generated by Bentley Context Capture. My goal is to find the closest tiepoint from the Bentley Context Capture aerial triangulation export for the ECEF coordinates generated by viewer.scene.pickPosition(click.position)

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Here is what I have done so far:

1. Get the Cartesian coordinates:

cartesian3d = viewer.scene.pickPosition(click.position)

1. Converting the Cartesian3 to WGS84 Lat/Long:

cartographic3d = cartesianToDegrees(viewer.scene.ellipsoid, cartesian3d)

const cartesianToDegrees = (ellipsoid, x) => {
const carto = ellipsoid.cartesianToCartographic(x);
const longitude = (carto.longitude * 180) / math.pi;
const latitude = (carto.latitude * 180) / math.pi;
return [longitude, latitude, carto.height];
};

I have a list of tiepoints from the aerial triangulation step of Bentley Context Capture, this is the reference system that was used: EPSG:28356

1. Now to convert the tiepoint (in Python whereby I load the Bentley Context Capture Aerial Triangulation XML file):

tiepoint = (298886.689734013, 6229317.15626832, 26.6625023260713)

``

I now have to convert the tiepoint from EPSG:28356 to WGS84 I use pyproj:

in_proj = Proj("EPSG:28356")

out_proj = Proj("+init=EPSG:4326")

wgs_coords = transform(in_proj, out_proj, x=tiepoint[0], y=tiepoint[1], z=tiepoint[2])

Which is: (150.82094535413248, -34.05758120402254, 26.6625023260713)

I then do this for all the tiepoints, then I am able to query for the nearest tiepoint using a KD tree.

Now I click on my 3D Cesium tileset to get the cartographic3d coordinate, and try to find the nearest matching tiepoint. The problem is that retrieved doesn’t match up to the point that I have clicked on the model, it always seems a few meters off.

I’m thinking that I must have done something wrong with the conversion but I can’t seem to find out what it is. If I’m not wrong Cesium uses ECEF for Cartesian3d, and ellipsoid.cartesianToCartographic is called I can confirm we are using the WGS84 ellipsoid.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to see the actual images in more detail as the resolution of the 3D model isn’t as high as the actual photos

4. The Cesium version you’re using, your operating system and browser.

macOS Mojave, version 10.14.5

CesiumJS does use ECEF for Cartesian3. This whole process sounds correct in theory. The only thing I’m not sure of is in step 3 - are you converting the cartographic point into EPSG:28356 in that step? I wonder if there’s some accuracy loss somewhere in this chain of conversions.

Just out of curiosity, did you try tiling your model with Cesium ion (https://cesium.com/ion) ? It should preserve the resolution of the source data. There is also an offline version of the tiling pipeline available.