Reputation: 3294
I have latitude, longitude and a radius. Can you please help me in finding the another latitude and longitude from given points (latitude and longitude) and radius.
Upvotes: 1
Views: 1691
Reputation: 3587
You will need more information than a point and a radius. You are also going to need the angle of the point in the circle.
Using the radius and the angle you have to apply trigonometric laws and draw and imaginary triangle with dimensions radius, height and width. The height and width will give you the distance from the current latitude and longitude.
For example:
for (int angle = 0; angle < 360; angle++){
double x = getDistanceX(radius, angle);
double y = getDistanceY(radius, angle);
if (angle > 180)
x *= -1;
if (angle > 90 && angle < 270)
y *= -1;
double newLatitude = getCalculateLatitude(latitude, x);
double newLongitude = getCalculateLatitude(longitude, y);
}
Upvotes: 1
Reputation: 152
Are you trying to find out if another latitude and longitude is within a certain radius of your initial latitude and longitude? If so, check out this other StackOverflow post.
Upvotes: 1