Hello, when I use the Java API, I need to convert the coordinate system of the camera. I refer to the coordinate conversion writing method in Python, but the final result does not write the new coordinates. Please help me find the problem with this writing.
CoordinateSystem targetCrs = new CoordinateSystem();
targetCrs.init("EPSG::3857");
for (int key : chunk.getCameraKeys()) {
Camera camera = chunk.getCamera(key).get();
Vector vector = camera.getReference().getLocation().get();
Vector targetVector = CoordinateSystem.transform(vector, chunk.getCoordinateSystem(), targetCrs);
camera.getReference().setLocation(Optional.of(targetVector));
System.out.println(vector);
System.out.println(targetVector);
Vector vector1 = camera.getReference().getLocation().get();
System.out.println("location2: " + vector1.getX() + " " + vector1.getY()); // The coordinates have not changed after re-reading
}
I tried getting the camera array using chunk.getCameras(), but it returned null no matter what, so I used the getCamera(key) method to get the camera. Is this related?
Camera[] cameras = chunk.getCameras();
Please give me a java-api version of the coordinate conversion example, thank you very much
metashape-java-api-version:1.8
java-version:1.8.0_162
OS:Windows 11