<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: C#, GPS Receivers, and Geocaching: Vincenty&#8217;s Formula</title>
	<atom:link href="http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/</link>
	<description>Mike Gavaghan blogs on Java, C#, .Net, and the software industry</description>
	<lastBuildDate>Sat, 26 Nov 2011 17:37:47 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: S Pola</title>
		<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/comment-page-1/#comment-847</link>
		<dc:creator>S Pola</dc:creator>
		<pubDate>Mon, 15 Aug 2011 07:56:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/#comment-847</guid>
		<description>Hi Mike,

Your explanation and your C# library itself are brilliant. I&#039;ve made use of your library in a small application I&#039;ve built to make a grid of points. Your code and the example made my task much easier. Thanks very much. 

Cheers
S Pola</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>Your explanation and your C# library itself are brilliant. I&#8217;ve made use of your library in a small application I&#8217;ve built to make a grid of points. Your code and the example made my task much easier. Thanks very much. </p>
<p>Cheers<br />
S Pola</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roman</title>
		<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/comment-page-1/#comment-843</link>
		<dc:creator>Roman</dc:creator>
		<pubDate>Wed, 01 Jun 2011 02:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/#comment-843</guid>
		<description>Hi Mike,

Thank you for sharing this valuable information with others!

Regards,

Roman</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>Thank you for sharing this valuable information with others!</p>
<p>Regards,</p>
<p>Roman</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Clemens</title>
		<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/comment-page-1/#comment-839</link>
		<dc:creator>Clemens</dc:creator>
		<pubDate>Wed, 10 Nov 2010 19:29:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/#comment-839</guid>
		<description>Hi Mike,

I just came across your implementation of Vincenty&#039;s inverse formula.
Two points are worth mentioning:

1. Marcelo is right in his comment from June 2008. Equations 3, 4 and 6 do not have to be calculated inside the loop.
Neither Vincenty in his original paper does it, nor does the pseudo code in Wikipedia (http://en.wikipedia.org/wiki/Vincenty&#039;s_formulae) or the online calculator on Movable Type Scripts (http://www.movable-type.co.uk/scripts/latlong-vincenty.html).

2. In line 268 you should not use the relative change abs((lambda - lambda0) / lambda) as stop criterion, since lambda is a longitude difference, which may be zero.
Calculating the distance between two point on the same meridian might well result in a division by zero. At least the algorithm iterates much to often.
Simply use abs(lambda - lambda0) instead.

Cheers
Clemens</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>I just came across your implementation of Vincenty&#8217;s inverse formula.<br />
Two points are worth mentioning:</p>
<p>1. Marcelo is right in his comment from June 2008. Equations 3, 4 and 6 do not have to be calculated inside the loop.<br />
Neither Vincenty in his original paper does it, nor does the pseudo code in Wikipedia (<a href="http://en.wikipedia.org/wiki/Vincenty" rel="nofollow">http://en.wikipedia.org/wiki/Vincenty</a>&#8217;s_formulae) or the online calculator on Movable Type Scripts (<a href="http://www.movable-type.co.uk/scripts/latlong-vincenty.html" rel="nofollow">http://www.movable-type.co.uk/scripts/latlong-vincenty.html</a>).</p>
<p>2. In line 268 you should not use the relative change abs((lambda &#8211; lambda0) / lambda) as stop criterion, since lambda is a longitude difference, which may be zero.<br />
Calculating the distance between two point on the same meridian might well result in a division by zero. At least the algorithm iterates much to often.<br />
Simply use abs(lambda &#8211; lambda0) instead.</p>
<p>Cheers<br />
Clemens</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Friedman</title>
		<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/comment-page-1/#comment-838</link>
		<dc:creator>Robert Friedman</dc:creator>
		<pubDate>Tue, 26 Oct 2010 21:23:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/#comment-838</guid>
		<description>Hi Mike,
    This is great code.  It is very well written and the example made it easy for my use.  I am actually a retired engineer and I wanted to develop an application for use with my Garmin GPS.   One feature was to measure the distance from a reference way point and everything else in the GPS.  I started out using the Haversine sine method which gave me fairly good results.  I found the distances were a mile or so off when measuring long distance of a few thousand miles across the US.  My numbers never complelely agreed with my Garmin GPS when I view distances in the waypoint favorites lists.   With a little Google searching, I found your C# code.  Within a half hour, I had your distance calculations working.  No changes whatsoever were needed.  The distance calculations were in complete agreement with my GPS.  Orginally I simply included your library code as an include project.  This work fine except a .dll was created.  I really didn&#039;t want another .dll so I simply took all the c# code in Gavaghan.Geodsy and copied it into my source code.  That embedded your code and I then had no need for the .dll;
   Thanks again for such a good piece of code.</description>
		<content:encoded><![CDATA[<p>Hi Mike,<br />
    This is great code.  It is very well written and the example made it easy for my use.  I am actually a retired engineer and I wanted to develop an application for use with my Garmin GPS.   One feature was to measure the distance from a reference way point and everything else in the GPS.  I started out using the Haversine sine method which gave me fairly good results.  I found the distances were a mile or so off when measuring long distance of a few thousand miles across the US.  My numbers never complelely agreed with my Garmin GPS when I view distances in the waypoint favorites lists.   With a little Google searching, I found your C# code.  Within a half hour, I had your distance calculations working.  No changes whatsoever were needed.  The distance calculations were in complete agreement with my GPS.  Orginally I simply included your library code as an include project.  This work fine except a .dll was created.  I really didn&#8217;t want another .dll so I simply took all the c# code in Gavaghan.Geodsy and copied it into my source code.  That embedded your code and I then had no need for the .dll;<br />
   Thanks again for such a good piece of code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/comment-page-1/#comment-833</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Mon, 23 Aug 2010 09:07:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/#comment-833</guid>
		<description>Hi Mike,

Just wanted to say thanks for ur c# implementation of Vincenty’s formula, 

cheers,
 steve</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>Just wanted to say thanks for ur c# implementation of Vincenty’s formula, </p>
<p>cheers,<br />
 steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aharon Levine</title>
		<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/comment-page-1/#comment-832</link>
		<dc:creator>Aharon Levine</dc:creator>
		<pubDate>Tue, 10 Aug 2010 09:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/#comment-832</guid>
		<description>Hi Mike

Thanks so much for sharing this brilliant code, it has proved invaluable to me in several projects.
I would like to propose a small change which made the code more robust for real applications:
The function GeodeticCalculator.calculateEndingGlobalCoordinates(...) goes into an infinite loop if its distance parameter is given as 0.
I added these lines to the beginning of the function:

if (distance == 0)
{
	 return new GlobalCoordinates(start.getLatitude(), start.getLongitude());
}

Thanks again
Aharon</description>
		<content:encoded><![CDATA[<p>Hi Mike</p>
<p>Thanks so much for sharing this brilliant code, it has proved invaluable to me in several projects.<br />
I would like to propose a small change which made the code more robust for real applications:<br />
The function GeodeticCalculator.calculateEndingGlobalCoordinates(&#8230;) goes into an infinite loop if its distance parameter is given as 0.<br />
I added these lines to the beginning of the function:</p>
<p>if (distance == 0)<br />
{<br />
	 return new GlobalCoordinates(start.getLatitude(), start.getLongitude());<br />
}</p>
<p>Thanks again<br />
Aharon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus</title>
		<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/comment-page-1/#comment-247</link>
		<dc:creator>Markus</dc:creator>
		<pubDate>Thu, 21 Jan 2010 04:42:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/#comment-247</guid>
		<description>Hello Mike,

Thanks for sharing your information. I found it very intriguing, but too much for my simple question. I was wondering if you could shed some light on my problem.

I need to generate a bounding box of min and max latitude and longitude values so I can return addresses within a given radius.

I have two func&#039;s below to return the range I need to +/- to the lon lat coordinates to establish the bounding box. However I don&#039;t think the math is 100%

I am using the Haversine formula to generate my distance calculations and that seems to be working accurately. I investigated the Vincenty formula for distance as well but for my needs that was overkill.

My problem is that I would like my search results to be as accurate as Haversine in that the range I +/- to the lon lat coordinates takes into account the ellipsoidal curvature or the earth.

Ok, here are my func&#039;s...please note I am not a Math professor :o)

static Func GetLatitudeRange = (latitude, distance) =&gt; (180.0 / Math.PI) * (distance / EARTH_RADIUS_IN_KM);


static Func GetLongitudeRange = (longitude, latitude, distance) =&gt;
            (
                Math.Asin(
                    Math.Sin(distance / EARTH_RADIUS_IN_KM) / Math.Cos(latitude)
                    )
            );

Many Thanks,
Markus</description>
		<content:encoded><![CDATA[<p>Hello Mike,</p>
<p>Thanks for sharing your information. I found it very intriguing, but too much for my simple question. I was wondering if you could shed some light on my problem.</p>
<p>I need to generate a bounding box of min and max latitude and longitude values so I can return addresses within a given radius.</p>
<p>I have two func&#8217;s below to return the range I need to +/- to the lon lat coordinates to establish the bounding box. However I don&#8217;t think the math is 100%</p>
<p>I am using the Haversine formula to generate my distance calculations and that seems to be working accurately. I investigated the Vincenty formula for distance as well but for my needs that was overkill.</p>
<p>My problem is that I would like my search results to be as accurate as Haversine in that the range I +/- to the lon lat coordinates takes into account the ellipsoidal curvature or the earth.</p>
<p>Ok, here are my func&#8217;s&#8230;please note I am not a Math professor <img src='http://www.gavaghan.org/blog/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )</p>
<p>static Func GetLatitudeRange = (latitude, distance) =&gt; (180.0 / Math.PI) * (distance / EARTH_RADIUS_IN_KM);</p>
<p>static Func GetLongitudeRange = (longitude, latitude, distance) =&gt;<br />
            (<br />
                Math.Asin(<br />
                    Math.Sin(distance / EARTH_RADIUS_IN_KM) / Math.Cos(latitude)<br />
                    )<br />
            );</p>
<p>Many Thanks,<br />
Markus</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/comment-page-1/#comment-246</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Thu, 14 Jan 2010 10:38:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/06/c-gps-receivers-and-geocaching-vincentys-formula/#comment-246</guid>
		<description>Hi Mike,
Thanks for sharing this. It is a great help and timesaver for my little freeware project: Generation of airspace boundaries to be uploaded to an Variometer/GPS unit for Paraglider and Hanglider pilots.
Many thanks &amp; Regards from Switzerland
Daniel</description>
		<content:encoded><![CDATA[<p>Hi Mike,<br />
Thanks for sharing this. It is a great help and timesaver for my little freeware project: Generation of airspace boundaries to be uploaded to an Variometer/GPS unit for Paraglider and Hanglider pilots.<br />
Many thanks &amp; Regards from Switzerland<br />
Daniel</p>
]]></content:encoded>
	</item>
</channel>
</rss>

