The Geodetic class can be used to calculate azimuths, distances, and Points on an Ellipsoid. It is inspired by the wonderful pyproj library.
def g = new Geodetic() def inverse = g.inverse(new Point(-71.1166666667,42.25), new Point(-123.6833333333,45.5166666667)) println inverse.forwardAzimuth -66.5304369615103 println inverse.backAzimuth 75.65384304860314 println inverse.distance 4164074.239295728
Constructor and description |
---|
Geodetic
() Create a new Geodetic using the default WGS84 ellipsoid. |
Geodetic
(java.lang.String ellipsoid) Create a new Geodetic using the name to look up an ellipsoid. |
Geodetic
(DefaultEllipsoid ellipsoid) Create a new Geodetic using the GeoTools DefaultEllipsoid |
Type Params | Return Type | Name and description |
---|---|---|
|
java.lang.Object |
forward(Point pt, double azimuth, double distance) Calculate a new Point and back azimuth given the starting Point, azimuth, and distance. |
|
java.lang.Object |
inverse(Point pt1, Point pt2) Calculate the forward and back azimuth and distance between the given two Points. |
|
java.util.List<Point> |
placePoints(Point pt1, Point pt2, int numberOfPoints) Place the given number of points between starting and ending Points |
|
java.lang.String |
toString() The string representation. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
The GeoTools Ellipsoid used in calculations
Create a new Geodetic using the default WGS84 ellipsoid.
Create a new Geodetic using the name to look up an ellipsoid.
ellipsoid
- The name of the ellipsoid.Create a new Geodetic using the GeoTools DefaultEllipsoid
ellipsoid
- The GeoTools DefaultEllipsoidCalculate a new Point and back azimuth given the starting Point, azimuth, and distance.
pt
- The starting Pointazimuth
- The azimuthdistance
- The distanceCalculate the forward and back azimuth and distance between the given two Points.
pt1
- The starting Pointpt2
- The ending PointPlace the given number of points between starting and ending Points
pt1
- The start Pointpt2
- The end PointnumberOfPoints
- The number of PointsThe string representation.
Groovy Documentation