I am working on an application with Spatial data. Here I need to find the distance from the centroid to a point. Can know how to convert miles to degrees in Java?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Final Edit: Look into Great Circle Distance and Geodesics to discover the complexities of what you were really asking in this question. This is admittedly well out of my familiarity with mathematics.
[Leaving original suggestions in for historical reasons. Though pieces may help you, they will not directly answer your question.]
See https://stackoverflow.com/a/1253545/1964221 for the answer to this question.
To go the other direction, I wonder if we can do this(my algebra is rusty):
Latitude: 1 km = 1 deg / 110.54 km
Longitude: 1 km = 1 deg / (111.320*cos(latitude) km)
Application
Is your distance always strictly East-West or North-South? If so, you should be able to say:
or
More than likely, you will need to know distance in both North-South and East-West directions(and takes this into the realm of "not straight-forward). You could look at the Pythagorean Theorem. You know the "long side" of the triangle(c^2) and can calculate for longitude(a^2) and latitude(b^2).
You should be able to apply portions of my previous code snippets to figure out
c = sqrt(a^2 + b^2).
Good luck.