RE: [OpenMap Users] Calculate a Lat/Lon Pair given a starting Lat/Lon pair, a distance, and an angle?

From: Rick Lane <lane_richard_b_at_bah.com>
Date: Mon, 28 Mar 2005 10:07:07 -0500

Erich,

I'm not sure if OpenMap has this built-in (I would imagine it does though,
considering it would be a similar function to how GREAT_CIRCLE lines and
polys are drawn.

Below is a snippet of code that I use, and it seems to work well, though it
*does* take the great circle calculations into consideration.

Hope this helps (and let me know if you find an OpenMap version of this).

public static double[] getNewLatLon(double currentLat, double currentLon,
                                double distInNM, double dirDeg){
        double newLat,newLon;
        double radLat, radLon, radDist, radDir;
        double[] latLonArray = new double[2];
            
        radLat = Math.toRadians(currentLat);
        radLon = Math.toRadians(currentLon);
        radDist = (distInNM *Math.PI)/(180*60);
        radDir = Math.toRadians(dirDeg);
            
        newLat = Math.toDegrees(Math.asin(Math.sin(radLat)*Math.cos(radDist)
+
                        Math.cos(radLat) * Math.sin(radDist) *
Math.cos(radDir)));
            
        newLon = Math.toDegrees(radLon - Math.asin(Math.sin(radDir) *
                        Math.sin(radDist) / Math.cos(radLat)) * -1.0);
            
        latLonArray[0] = newLat;
        latLonArray[1] = newLon;
                                      
        return latLonArray;
}

-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com] On
Behalf Of Klaus, Erich P.
Sent: Monday, March 28, 2005 9:50 AM
To: OpenMap Users
Subject: [OpenMap Users] Calculate a Lat/Lon Pair given a starting Lat/Lon
pair, a distance, and an angle?

Hello everyone,

        Does anyone know if an API is included with OpenMap for doing a
calculation to get a Lat/Lon
pair given a starting Lat/Lon pair, a distance, and an angle? I've been
looking at ArcCalc and GreatCircle.

        The distance would be less than 5km and so probably not effected by
curvature of the earth much.

Thanks,

Erich Klaus
erich.klaus_at_REMOVE SPAM HEREzai.com
(Please Remove "REMOVE SPAM HERE" if replying directly)

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe
openmap-users"]
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Mar 28 2005 - 10:07:41 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT