Closed MarcelHeckel closed 7 years ago
The coordinate produces 5439627.33, 5661628.09 a completely wrong result when converting from EPSG:31469 to EPSG:3857 -4168119.848846665, 5803607.27843846 but should be something like: 1573655, 6636624
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.cts.CRSFactory; import org.cts.IllegalCoordinateException; import org.cts.crs.CRSException; import org.cts.crs.GeodeticCRS; import org.cts.op.CoordinateOperation; import org.cts.op.CoordinateOperationFactory; import org.cts.registry.EPSGRegistry; import org.cts.registry.RegistryManager; public class Test2 { public static void main(String[] args) { CRSFactory cRSFactory = new CRSFactory(); RegistryManager registryManager = cRSFactory.getRegistryManager(); registryManager.addRegistry(new EPSGRegistry()); double[] coord = new double[] { 5439627.33, 5661628.09 }; try { GeodeticCRS sourceGCRS = (GeodeticCRS) cRSFactory.getCRS("EPSG:31469"); GeodeticCRS targetGCRS = (GeodeticCRS) cRSFactory.getCRS("EPSG:3857"); List<CoordinateOperation> coortzdOps = new ArrayList<>( CoordinateOperationFactory.createCoordinateOperations(sourceGCRS, targetGCRS)); for (int i = 0; i < coortzdOps.size(); i++ ) { CoordinateOperation op = coortzdOps.get(i); coord = op.transform(coord); } } catch (IllegalCoordinateException | CRSException e) { e.printStackTrace(); } System.out.println(Arrays.toString(coord)); } }
Sorry, I should RTFM
The coordinate produces 5439627.33, 5661628.09 a completely wrong result when converting from EPSG:31469 to EPSG:3857 -4168119.848846665, 5803607.27843846 but should be something like: 1573655, 6636624