Hello,
How to get the azimuth from a point to a reference point? I can't find any tip from the samples.
Thanks.
Hello,
How to get the azimuth from a point to a reference point? I can't find any tip from the samples.
Thanks.
Hello feng,
Thanks for your post, I think you want to do is get the get the direction from one point to anther point, for this purpose, you can use this API:
arrowheadAngle = GetBearingBetweenTwoVertices(vertex1,vertex2);
and then with the angle you can determine what’s the direction, like:
45: NW
90: W
135: SW
180: S
225: SE
270: E
315: NE
Regards,
Gary
Hello Gary,
Thanks. But I cann't find the API "GetBearingBetweenTwoVertices" in Desktop Edition V6.0. Could you please give me more information?
Feng
Hi Feng,
We are sorry for the mistake in the last post, we double-checked in our code, there is no GetBearingBetweenTwoVertices, but the following code could be alternative:
private double GetAngleFromTwoPointShapes(PointShape PointShape1, PointShape PointShape2)
{
double TangAlpha = 0;
double Alpha = 0;
double Beta = 0;
if (PointShape2.X != PointShape1.X)
{
TangAlpha = (PointShape2.Y - PointShape1.Y) / (PointShape2.X - PointShape1.X);
Alpha = Math.Atan(TangAlpha) * (180 / Math.PI);
Beta = 90 - Alpha;
if (PointShape2.X < PointShape1.X)
{ Beta = Beta + 180; }
}
else
{
if (PointShape1.Y < PointShape2.Y)
{ Beta = 0; }
else
{ Beta = 180; }
}
return Beta;
}
arrowheadAngle= GetAngleFromTwoPointShapes(Point1,Point2)
Hope it helps
Edgar