diff options
| author | Martin Desruisseaux <martin.desruisseaux@geomatys.com> | 2018-04-27 18:42:10 +0200 |
|---|---|---|
| committer | Martin Desruisseaux <martin.desruisseaux@geomatys.com> | 2018-04-27 18:42:10 +0200 |
| commit | f477d608aa9cfdc3e2265034ca4fbdbe1dfc4c4d (patch) | |
| tree | 06d7ec57a886b469c3e8dbdb7f237f7fdedce8fc /jniwrap | |
| parent | 27d881add3d1fcd219c6b6ad455ef1c8b2a5abc3 (diff) | |
| download | PROJ-f477d608aa9cfdc3e2265034ca4fbdbe1dfc4c4d.tar.gz PROJ-f477d608aa9cfdc3e2265034ca4fbdbe1dfc4c4d.zip | |
Renamed jniwrap/README as README.md for better integration with GitHub.
Reformatted the README.md content for Markdown syntax.
Updated some content to reflect the changes applied in build.xml file.
Diffstat (limited to 'jniwrap')
| -rw-r--r-- | jniwrap/Makefile.am | 2 | ||||
| -rw-r--r-- | jniwrap/README | 128 | ||||
| -rw-r--r-- | jniwrap/README.md | 120 |
3 files changed, 121 insertions, 129 deletions
diff --git a/jniwrap/Makefile.am b/jniwrap/Makefile.am index 595093f6..908eee37 100644 --- a/jniwrap/Makefile.am +++ b/jniwrap/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST = build.xml doxygen.cfg README +EXTRA_DIST = build.xml doxygen.cfg README.md SUBDIRS = org diff --git a/jniwrap/README b/jniwrap/README deleted file mode 100644 index 1c047db0..00000000 --- a/jniwrap/README +++ /dev/null @@ -1,128 +0,0 @@ - -------------------- J P R O J . 4 -------------------- - -This is the second release of JNI wrappers for the main proj4 functions. - -PLEASE read the following information. - -The first release of JNI wrappers were created by: - - http://www.hydrologis.com - -For more information regarding the current release please see the web page at: - - http://www.geoapi.org/geoapi-proj4/ - - --------------------------------------------------- - - -What is "Proj.4 wrapper": -------------- - -"Proj.4 wrapper" is a small library of Java classes that wrap a few Proj.4 functions by -using the Java Native Interface (JNI). The main Java class is org.proj4.PJ. - - -Compilation: -------------- - -To compile the native part, configure has to be run in the proj directory like this: - - CFLAGS=-Iinclude2 ./configure --with-jni=include1 - -where - - include1 = folder in which the header file jni.h resides (usually $JAVA_HOME/include) - include2 = folder in which the header file jni_md.h resides (usually $JAVA_HOME/include/linux or whatever) - -On MacOS, those two folders are /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/include/ - - -The java part is compiled by running ant inside the "jniwrap" folder. -This will compile the classes and archive them in a jar library. -It applies to Linux, Macos and Windows (and virtually to every system -supporting java). - - -Requirements: -------------- - -Beyond the ones already put by Proj.4, you need: -- JSE 1.5+, the Java standard development kit version 1.5 or above -- Ant, to run the build -- Doxygen for the documentation generation - - -Documentation: --------------- - -The documentation is held inside the code and can be retrieved by running -doxygen inside the folder jniwrap. This will create the HTML format -documentation inside of jniwrap/docs - -The standard way to achieve this is to use an Ant target: - - ant do_make_help - - -License: --------- - -GPL for the first release -Proj.4 license for the second release. - - -Authors: --------- - -Andrea Antonello (andrea.antonello@hydrologis.com) -Martin Desruisseaux (martin.desruisseaux@geomatys.fr) - - -Usage & a fast example: ------------------------ - -The jproj.jar is all is needed to implement proj support in java applications. -The whole job is done by the proj4, so there are just a couple of functions that -be used. - -The best way is to see everything through an example. -In the following example we create two Coordinate System and transform 3 points. -The Coordinate System and the points are hard-coded for simplicity. Of course, -real applications would read them from a file or other data source. - -________________________________________________________________________________ -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 Main { - 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)); - } -} -________________________________________________________________________________ - -compile the Main code: -we assume that proj was compiled with the right flag to support jproj. -Therefore we have a library called jproj.jar. -Thus we compile the Main.java with the command: - -javac -classpath <path to the jar library>/jproj.jar Main.java - -and execute the created test case with: - -java -cp .:<path to the jar library>/jproj.jar -Djava.library.path=<path to the libproj, if needed> Main - -That's it, enjoy! diff --git a/jniwrap/README.md b/jniwrap/README.md new file mode 100644 index 00000000..45772d1f --- /dev/null +++ b/jniwrap/README.md @@ -0,0 +1,120 @@ +# Proj bridge to Java + +This is the third release of JNI wrappers for the main Proj functions. +The first release of JNI wrappers were created by http://www.hydrologis.com. +The second release of JNI wrappers were created by http://www.geoapi.org. + + + +## What is "Proj bridge to Java" + +_Proj bridge to Java_ is a small library of Java classes that wrap a few Proj functions +by using the Java Native Interface (JNI). The main Java class is `org.proj4.PJ`. + + + +### Compilation + +To compile the native part, `configure` has to be run in the Proj directory like this: + + CFLAGS=-Iinclude2 ./configure --with-jni=include1 + +where + +* `include1` = folder in which the header file `jni.h` resides (usually `$JAVA_HOME/include`) +* `include2` = folder in which the header file `jni_md.h` resides (usually `$JAVA_HOME/include/linux` or whatever) + +On MacOS, those two folders are `/Library/Java/JavaVirtualMachines/.../Contents/Home/include/`. + + +The java part is compiled by running Ant inside the `jniwrap` folder. +This will compile the classes and archive them in a JAR file. +It applies to Linux, MacOS and Windows (and virtually to every system supporting java). + + + +### Requirements + +Beyond the ones already put by Proj, you need: + +* For compilation: + * Java 9+, the Java standard development kit version 9 or above + * Ant 1.9.8+, to run the build. +* For execution: + * If a Java version less than the current version on the local machine is desired, + add an `release` attribute in the `javac` task of `build.xml`. + + + +### Documentation + +The documentation is held inside the code and can be retrieved by running +doxygen inside the folder jniwrap. This will create the HTML format +documentation inside of jniwrap/docs + +The standard way to achieve this is to use an Ant target: + + ant do_make_help + + + +### License + +GPL for the first release. +Proj.4 license for the second release. + + + +### Authors + +* Andrea Antonello (andrea.antonello@hydrologis.com) +* Martin Desruisseaux (martin.desruisseaux@geomatys.com) + + + +## Usage & a fast example: + +The `proj.jar` is all is needed to implement Proj support in java applications. +The whole job is done by the Proj library, so there are just a couple of functions that be used. + +The best way is to see everything through an example. +In the following example we create two Coordinate Reference System and transform 3 points. +The Coordinate Reference Systems and the points are hard-coded for simplicity. +Of course, real applications would read them from a file or other data source. + + 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 Main { + 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)); + } + } + + + +### compile the Main code + +we assume that Proj was compiled with the right flag to support the bridge to Java +Therefore we have a library called `proj.jar`. +Thus we compile the `Main.java` with the command: + + javac -classpath <path to the jar library>/proj.jar Main.java + +and execute the created test case with: + + java -cp .:<path to the jar library>/proj.jar -Djava.library.path=<path to the libproj, if needed> Main + +That's it, enjoy! |
