1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-26 04:35:39 +03:00
aports/testing/proj/TestJni.java
2019-06-18 10:02:38 -03:00

20 lines
770 B
Java

import org.proj4.*;
import java.util.Arrays;
/**
* Converts coordinates from EPSG:32632 (WGS 84 / UTM zone 32N) to WGS84,
* then prints the result to the standard output stream.
*/
public class TestJni {
public static void main(String[] args) throws PJException {
PJ sourcePJ = new PJ("+init=epsg:32632"); // (x,y) axis order
PJ targetPJ = new PJ("+proj=latlong +datum=WGS84"); // (λ,φ) axis order
double[] coordinates = {
500000, 0, // First coordinate
400000, 100000, // Second coordinate
600000, -100000 // Third coordinate
};
sourcePJ.transform(targetPJ, 2, coordinates, 0, 3);
System.out.println(Arrays.toString(coordinates));
}
}