<?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: Zip code radius calculation algorithm</title>
	<atom:link href="http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/feed/" rel="self" type="application/rss+xml" />
	<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Fri, 30 Jul 2010 19:24:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: admin</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-503</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 26 May 2009 20:08:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-503</guid>
		<description>@Iryna, that's just part of *one* formula for calculating the distance between two waypoints. Like I said, there are many ways to calculate the distance, depending on how accurate you want to measure it. For most applications this formula will work just fine.</description>
		<content:encoded><![CDATA[<p>@Iryna, that&#8217;s just part of *one* formula for calculating the distance between two waypoints. Like I said, there are many ways to calculate the distance, depending on how accurate you want to measure it. For most applications this formula will work just fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iryna</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-502</link>
		<dc:creator>Iryna</dc:creator>
		<pubDate>Tue, 26 May 2009 18:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-502</guid>
		<description>Can you please explain where does the number 3959 come from?

Thank you</description>
		<content:encoded><![CDATA[<p>Can you please explain where does the number 3959 come from?</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-499</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Thu, 07 May 2009 23:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-499</guid>
		<description>I used the between clause instead of the whole &lt; =... makes more sense if someone looks at the sql later on at least to me</description>
		<content:encoded><![CDATA[<p>I used the between clause instead of the whole &lt; =&#8230; makes more sense if someone looks at the sql later on at least to me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John C</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-468</link>
		<dc:creator>John C</dc:creator>
		<pubDate>Mon, 09 Feb 2009 22:40:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-468</guid>
		<description>Got it,... thanks so much for taking the time to give a concrete example.
Best, John C</description>
		<content:encoded><![CDATA[<p>Got it,&#8230; thanks so much for taking the time to give a concrete example.<br />
Best, John C</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-467</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 09 Feb 2009 14:33:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-467</guid>
		<description>@ John C, my intent was to keep this article as general as possible so it would be applicable to any scripting/database language but perhaps a specific example will be helpful to others.

So - The SQL statement you would use to get the initial set of records within 10 miles of your target coordinates would be: 

&lt;code&gt;SELECT * FROM zip WHERE latitude &gt;= '40.681 - 0.20' AND latitude &lt;= '40.681 + 0.20' AND longitude &gt;= '-73.845 - 0.143' AND longitude &lt;= '-73.845 + 0.143';
&lt;/code&gt;

To eliminate the coordinates outside your radius (remember, the set returned by SQL is approximate and is a square, see the image in the post) you'll need to do some calculations to find exact distances between your target and EACH point. You probably won't want to do this in SQL since the calculations can be complicated (again, see above) - I choose to do this in PHP instead.</description>
		<content:encoded><![CDATA[<p>@ John C, my intent was to keep this article as general as possible so it would be applicable to any scripting/database language but perhaps a specific example will be helpful to others.</p>
<p>So - The SQL statement you would use to get the initial set of records within 10 miles of your target coordinates would be: </p>
<p><code>SELECT * FROM zip WHERE latitude >= '40.681 - 0.20' AND latitude < = '40.681 + 0.20' AND longitude >= &#8216;-73.845 - 0.143&#8242; AND longitude < = '-73.845 + 0.143';<br />
</code></p>
<p>To eliminate the coordinates outside your radius (remember, the set returned by SQL is approximate and is a square, see the image in the post) you&#8217;ll need to do some calculations to find exact distances between your target and EACH point. You probably won&#8217;t want to do this in SQL since the calculations can be complicated (again, see above) - I choose to do this in PHP instead.</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John C</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-466</link>
		<dc:creator>John C</dc:creator>
		<pubDate>Mon, 09 Feb 2009 03:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-466</guid>
		<description>Thanks for the fast reply, sorry I have no idea what the ± symbol is? is that a plus-minus sign?. or I guess I can just use 0.143?. When doing this calculation?. Finally, is it on the SQL side?, because I notice you do a select statement like so.
SELECT * FROM zip WHERE latitude &gt;= ‘c’ AND latitude = ‘a’ AND longitude &lt;= ‘b’).

Or is it like, get the zip codes lat &amp; long where zip_code='somezip'  in a query, then calculate the c,d,a,b on this result set of the lat &amp; long returned. Then do another query using the calculation off of that?. Thanks so much for sharing and taking the time to reply.
Best, John C</description>
		<content:encoded><![CDATA[<p>Thanks for the fast reply, sorry I have no idea what the ± symbol is? is that a plus-minus sign?. or I guess I can just use 0.143?. When doing this calculation?. Finally, is it on the SQL side?, because I notice you do a select statement like so.<br />
SELECT * FROM zip WHERE latitude &gt;= ‘c’ AND latitude = ‘a’ AND longitude &lt;= ‘b’).</p>
<p>Or is it like, get the zip codes lat &amp; long where zip_code=&#8217;somezip&#8217;  in a query, then calculate the c,d,a,b on this result set of the lat &amp; long returned. Then do another query using the calculation off of that?. Thanks so much for sharing and taking the time to reply.<br />
Best, John C</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-465</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 08 Feb 2009 13:18:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-465</guid>
		<description>@ John C, it's very simple: -73.845 ± 1/7 (or 0.143) and 40.681 ± 1/5.</description>
		<content:encoded><![CDATA[<p>@ John C, it&#8217;s very simple: -73.845 ± 1/7 (or 0.143) and 40.681 ± 1/5.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John C</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-464</link>
		<dc:creator>John C</dc:creator>
		<pubDate>Sun, 08 Feb 2009 05:48:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-464</guid>
		<description>ok, say my longitude is -73.845 and the latitude is 40.681 and this is in some database, and I want to get the other zip codes in 10 mile radius. How do you calculate degrees by 1/7 ? to get points a and b?.  Whats the formula for something like that?. Any examples?
Thanks, John</description>
		<content:encoded><![CDATA[<p>ok, say my longitude is -73.845 and the latitude is 40.681 and this is in some database, and I want to get the other zip codes in 10 mile radius. How do you calculate degrees by 1/7 ? to get points a and b?.  Whats the formula for something like that?. Any examples?<br />
Thanks, John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Terry</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-458</link>
		<dc:creator>Terry</dc:creator>
		<pubDate>Fri, 05 Dec 2008 02:26:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-458</guid>
		<description>Thanks admin, that helps a lot.</description>
		<content:encoded><![CDATA[<p>Thanks admin, that helps a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://reviewapp.com/blog/2006/05/07/zip-code-radius-calculation-algorithm/comment-page-1/#comment-457</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 04 Dec 2008 17:51:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.tripleblaze.com/blog/?p=75#comment-457</guid>
		<description>@ Terry - good question, sorry that wasn't made more clear. 

A good place to start is by assuming that 1 degree of longitude is about 70 miles wide. So, for example, if you're looking at a 10 mile radius you'll want points a and b to be 1/7 degree of longitude to the left and right of your center point. 

Degrees of latitude vary as you move away from the equator but a good estimate for these is about 50 miles apart. So, take you starting point and move up and down 1/5 degree to get c and d.</description>
		<content:encoded><![CDATA[<p>@ Terry - good question, sorry that wasn&#8217;t made more clear. </p>
<p>A good place to start is by assuming that 1 degree of longitude is about 70 miles wide. So, for example, if you&#8217;re looking at a 10 mile radius you&#8217;ll want points a and b to be 1/7 degree of longitude to the left and right of your center point. </p>
<p>Degrees of latitude vary as you move away from the equator but a good estimate for these is about 50 miles apart. So, take you starting point and move up and down 1/5 degree to get c and d.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
