Doing the same conversion in Java code using just the libraries imported by the Maven artifact org.orbisgis:h2gis-functions:1.3.2 works perfectly fine:
import java.util.List;
import org.cts.CRSFactory;
import org.cts.IllegalCoordinateException;
import org.cts.crs.CRSException;
import org.cts.crs.CoordinateReferenceSystem;
import org.cts.crs.GeodeticCRS;
import org.cts.op.CoordinateOperation;
import org.cts.op.CoordinateOperationFactory;
import org.cts.registry.EPSGRegistry;
import org.junit.jupiter.api.Test;
import io.quarkus.test.junit.QuarkusTest;
// test code based on
@QuarkusTest
public class CoordinatesTransformationTest {
@Test
void testConvertAustriaGkEastToGPS() throws CRSException, IllegalCoordinateException {
var crsFactory = new CRSFactory();
crsFactory.getRegistryManager().addRegistry(new EPSGRegistry());
CoordinateReferenceSystem gps = crsFactory.getCRS("EPSG:4326");
CoordinateReferenceSystem austria = crsFactory.getCRS("EPSG:31256");
List<CoordinateOperation> ops = CoordinateOperationFactory
.createCoordinateOperations((GeodeticCRS) austria, (GeodeticCRS) gps);
double[] coord = new double[2];
coord[0] = -38048.66; // Longitude or Easting
coord[1] = 389405.66; // Latitude or Northing
for (var op : ops) {
var transformedCoord = op.transform(coord);
System.out.println("Longitude: " + transformedCoord[0] + " Latitude: " + transformedCoord[1]);
}
}
}
It outputs
Longitude: 15.815805676616735 Latitude: 48.64153355841612
What am I doing wrong in the SQL version?
Any help is appreciated. Thank you very much!
best regards,
Christoph