Hello all
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:
ftp://ftp.ngs.noaa.gov/pub/pcsoft/for_inv.3d/source
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
(method Ellipsoid.orthodromicDistance).
If porting the NOAA code from Fortran to Java is not a pratical
solution, a possible workaround for small distance is two perform the
following step:
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
step 1.
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.
Regards,
Martin.
