From: David R Robison <drrobison@op...> - 2003-01-06 13:11:43
Is there a way with geotools to calculate the Lat/Lon given a starting Lat/Lon,
a heading, and a distance. For example, if I want to get the corner Lat/Lon
coordinates for a box 100km on a side starting at a specific Lat/Lon, how would
do it with geotools?
From: Martin Desruisseaux <martin.desruisseaux@te...> - 2003-01-06 14:59:56
David R Robison wrote:
> Is there a way with geotools to calculate the Lat/Lon given a starting Lat/Lon,
> a heading, and a distance. For example, if I want to get the corner Lat/Lon
> coordinates for a box 100km on a side starting at a specific Lat/Lon, how would
> do it with geotools?
This is the geodetic problem and is not currently implemented in
Geotools 2. Source code for this problem is available in Fortran 77 there:
It could be ported to Java if someone is up to do that. Not that the
*inverse* geodetic problem is already ported, at least partially: from
two lat/lon coordinates, you can compute the distance between them
If porting the NOAA code from Fortran to Java is not a pratical
solution, a possible workaround for small distance is two perform the
1) Setup a map projection (e.g. Cylindrical Mercator).
2) Project the original point from lat/long coordinates
to cartesian coordinates, using the projection set in
3) Apply the translation (e.g. 100 km, 100 km).
4) Unproject the translated point from cartesian coordinates
to lat/lon coordinates, using the projection set in step 1.
The hard part is step 1. You can look at
MathTransformFactory.createParameterizedTransform(...) for that.