Converting Cartesian Coordinates to Lat and Lon with only x and y Cartesian Coordinates (Java)

49 views Asked by At

Is there a way to convert Cartesian coordinates to Lat and Lon while only knowing the X and Y Cartesian coordinates?

I'm trying to create a Java program to do they conversions and after some reading I currently have the following where R = the approx radius of the Earth in km 6371 and z I have assumed as 0.0:

        // Convert Cartesian coordinates to latitude and longitude
        double longitude = Math.atan2(y, x);
        double latitude = Math.asin(z / R);

        // Convert radians to degrees
        longitude = Math.toDegrees(longitude);
        latitude = Math.toDegrees(latitude);
0

There are 0 answers