How to find the latitude and longitude of a point from a given point, given the distance between them?

I want to find a point that is at a distance of X km from the current point, say A,  Example

if I know the latitude and longitude of the center point. How can I get the latitude, longitude of four points around the circumference .... I’ve been looking for SO for a long time, but I can’t get a solution in JavaScript or Java ... distance In my case it will be several kilometers, so I cant consider the earth as a flat surface , so plz does not offer such a solution ...

thank

0
source share
2 answers

, JavaScript:

, , , ( ) .

JavaScript:

var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + 
                      Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) );
var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1), 
                             Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));
+5

, , lat, lon ! , .

public class cal
{         
     public static void main(String []args){
         double R = 6371.0;
         double d = 0.100;
         double lat1 = 42.873, lon1 = 74.568;
         double Radlat1 = Math.toRadians(42.873);
         double Radlon1 = Math.toRadians(74.568);
         double brng = Math.toRadians(225);
         double lat2,lon2;

        System.out.println("Hello World");
        //lat2 = Math.sin();

        lat2 = Math.asin(Math.sin(Radlat1)*Math.cos(d/R) + 
                      Math.cos(Radlat1)*Math.sin(d/R)*Math.cos(brng));



         System.out.println("Lat2degree"+"="+Math.toDegrees(lat2)+"\n"+"Lat2="+lat2);

        double NewRadLat2 = Math.toRadians(Math.toDegrees(lat2));


        lon2 = Radlon1+Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(Radlat1), 
                             Math.cos(d/R)-Math.sin(Radlat1)*Math.sin(lat2));

        System.out.println("Lon2"+"="+Math.toDegrees(lon2));

     }
}
+2

Source: https://habr.com/ru/post/1778735/


All Articles