erotavlas
erotavlas

Reputation: 4493

How do I calculate the geocoordinates along a circle of fixed radius around a fixed geocoodinate?

I'm trying to write a c# class to do the following. In my image, I have a central geocoordinate on earth and I want to be able to get the geocoordinates that fall around that point at a fixed distance away.

I know three things

1 - central geocoordinate

2 - the distance away from the central point (either in Kilometers or in degrees latitude)

3 - and one geocoordinate along the circle

How can I get any other point along the circle?

Note: the center is NOT located on the earths geographic pole, but can be anywhere on earth

enter image description here

Upvotes: 1

Views: 668

Answers (1)

Gregor Primar
Gregor Primar

Reputation: 6805

If you assume that your circle is positioned in the center of .net graphics coordinate system you can use cos and sin functions inside Math class:

enter image description here

If "a" is an known angle and "r" is circle radius you can use following formula:

        double x = r * Math.Cos(a);
        double y = r * Math.Sin(a);

In the end you just need to add coordinates "cx" (circle center x), "cy" (circle center y) where your circle is positioned:

double xAbsolute = cx + x;
double yAbsolute = cy + y;

Happy coding!

Upvotes: 2

Related Questions