Packages | |
package | test |
Classes | |
class | Accumulator |
class | Constants |
class | Geodesic |
class | GeodesicData |
class | GeodesicLine |
class | GeodesicMask |
class | GeographicErr |
class | GeoMath |
class | Gnomonic |
class | GnomonicData |
class | Pair |
class | PolygonArea |
class | PolygonResult |
Implementation of the net.sf.geographiclib.Accumulator class
Copyright (c) Charles Karney (2013) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.Constants class
Copyright (c) Charles Karney (2013) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.Geodesic class
Copyright (c) Charles Karney (2013-2017) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.GeodesicData class
Copyright (c) Charles Karney (2013) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.GeodesicLine class
Copyright (c) Charles Karney (2013-2017) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.GeodesicMask class
Copyright (c) Charles Karney (2013-2014) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.GeographicErr class
Copyright (c) Charles Karney (2013) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.GeoMath class
Copyright (c) Charles Karney (2013-2017) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.Gnomonic class
Copyright (c) BMW Car IT GmbH (2014-2017) sebas and licensed under the MIT/X11 License. For more information, see tian .matt heis @bmw- cari t.dehttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.GnomonicData class
Copyright (c) BMW Car IT GmbH (2014-2016) sebas and licensed under the MIT/X11 License. For more information, see tian .matt heis @bmw- cari t.dehttps://geographiclib.sourceforge.io/
The documentation for other versions is available at https://geographiclib.sourceforge.io/m.nn/java
for versions numbers m.nn
≥ 1.31.
Licensed under the MIT/X11 License; see LICENSE.txt.
GeographicLib-Java is a Java implementation of the geodesic algorithms from GeographicLib. This is a self-contained library which makes it easy to do geodesic computations for an ellipsoid of revolution in a Java program. It requires Java version 1.2 or later.
Download either the source or the pre-built package as follows:
GeographicLib-Java is part of GeographicLib which available for download at
as either a compressed tar file (tar.gz) or a zip file. After unpacking the source, the Java library can be found in GeographicLib-1.49/java. (This library is completely independent from the rest of GeodegraphicLib.) The library consists of the files in the src/main/java/net/sf/geographiclib subdirectory.
GeographicLib-Java is available as a pre-built package on Maven Central (thanks to Chris Bennight for help on this deployment). So, if you use maven to build your code, you just need to include the dependency
in your
.
Included with the source are 3 small test programs
Here, for example, is
// Solve the inverse geodesic problem.// This program reads in lines with lat1, lon1, lat2, lon2 and prints// out lines with azi1, azi2, s12 (for the WGS84 ellipsoid).import java.util.*;try {Scanner in = new Scanner(System.in);double lat1, lon1, lat2, lon2;while (true) {lat1 = in.nextDouble(); lon1 = in.nextDouble();lat2 = in.nextDouble(); lon2 = in.nextDouble();GeodesicData g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2);}}catch (Exception e) {}}}
Three difference ways of compiling and running
are given. These differ in the degree to which they utilize maven to manage your Java code and its dependencies. (Thanks to Skip Breidbach for supplying the maven support.)
Compile and run as follows
cd inverse/src/main/java javac -cp .:../../../../src/main/java Inverse.java echo -30 0 29.5 179.5 | java -cp .:../../../../src/main/java Inverse
On Windows, change this to
cd inverse\src\main\java javac -cp .;../../../../src/main/java Inverse.java echo -30 0 29.5 179.5 | java -cp .;../../../../src/main/java Inverse
Use maven to create a jar file by running (in the main java directory)
mvn package
(Your first run of maven may take a long time, because it needs to download some additional packages to your local repository.) Then compile and run Inverse.java with
cd inverse/src/main/java javac -cp .:../../../../target/GeographicLib-Java-1.49.jar Inverse.java echo -30 0 29.5 179.5 | java -cp .:../../../../target/GeographicLib-Java-1.49.jar Inverse
The sample code includes a
which specifies GeographicLib-Jave as a dependency. You can build and install this dependency by running (in the main java directory)
mvn install
Alternatively, you can let maven download it from Maven Central. You can compile and run Inverse.java with
cd inverse mvn compile echo -30 0 29.5 179.5 | mvn -q exec:java
import net.sf.geographiclib.*in your source code.
The important classes are
net.sf.geographiclib.PolygonArea, a class to compute the perimeter and area of a geodesic polygon (returned as a {}).
The documentation is generated using javadoc when
is run (the top of the documentation tree is
). This is also available on the web at https://geographiclib.sourceforge.io/html/java/index.html.
Implementation of the net.sf.geographiclib.Pair class
Copyright (c) Charles Karney (2013) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.PolygonArea class
Copyright (c) Charles Karney (2013-2017) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/
Implementation of the net.sf.geographiclib.PolygonResult class
Copyright (c) Charles Karney (2013) charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttps://geographiclib.sourceforge.io/