traverse a line from a Geography point to find end geography point

Jan 27, 2010 at 10:41 AM

Hi -

Would someone be able to advise me the best way to do this?

I need to traverse from a Geography point, a distance of x (say 100m) to find that Geography point. 

Is the best way to do this to project the origin point to x,y and then use some trigonometry to find the point 100m away and then unproject back to Geography?

Or am I over-complicating things?

Looking at the Unproject method of MercatorProjection.cs, this always fails further down the line because longitude does not get set:

protected internal override void Unproject(double x, double y, out double latitude, out double longitude)
		{
			longitude = x;
			
			if (y >= MaxY)
			{
				latitude = Math.PI / 2;
			}
			else if (y <= -MaxY)
			{
				latitude = -Math.PI / 2;
			}
			else
			{
				latitude = Math.Atan(Math.Exp(y)) * 2 - Math.PI / 2;
			}
		}
fails here because longitude does not get set (to radians) above:
if (Double.IsNaN(longitude) || longitude < -Math.PI || longitude > Math.PI)
            {
                throw new ArgumentOutOfRangeException("longitude", String.Format(CultureInfo.InvariantCulture, Resource.OutputLongitudeIsOutOfRange, longitude));
            }

                                    

Jan 27, 2010 at 11:43 AM

I've found a posting that answers my first question (adding distance to a point to find the end point):

http://social.msdn.microsoft.com/Forums/en-US/sqlspatial/thread/10829142-b6ae-4aca-aec6-4764d191e516

but i'm still unsure about the Mercator Unproject method, if anyone has come across the same problem....