-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hello,
I'm trying to use your module because I need to apply custom transformation pipeline. However, it does not work.
I made a very simple example showing the issue, with incorrect values being returned while command line cct example works.
import java.util.Arrays;
import java.util.stream.Collectors;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import org.opengis.util.FactoryException;
import org.osgeo.proj.Proj;
public class DebugProjJni {
/**
* Working command line example <a href="https://proj-tmp.readthedocs.io/en/docs/operations/conversions/push.html#examples">here</a>
*
* @throws TransformException
*/
public static void main(String[] args) throws FactoryException, TransformException {
String pipeline = "+proj=pipeline +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 +step +proj=helmert +x=3000 +y=1000 +z=2000 +step +proj=cart +ellps=GRS80 +inv +step +proj=pop +v_3";
MathTransform transform = (MathTransform) Proj.createFromUserInput(pipeline);
double[] input = { 12, 56, 12.3, 2020 };
double[] output = new double[input.length];
transform.transform(input, 0, output, 0, 1);
System.out.println(String.format("Source: %s, Target: %s",
Arrays.stream(input).mapToObj(String::valueOf).collect(Collectors.joining(" ")),
Arrays.stream(output).mapToObj(String::valueOf).collect(Collectors.joining(" "))));
// Result is: Source: 12.0 56.0 12.3 2020.0, Target: 1.5671188250836727E-4 0.0 0.0 0.0
// Should be: 12.0056753463 55.9866540552 12.3000 2000.0000
}
}Either I'm a complete idiot or there is something here that does not work as expected.
For the record getSourceDimensions() and getTargetDimensions() both return 0 and I think it might be related...
Best regards, Adam.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels