|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
A Radius Search?Where would I go to learn how a radius search using a zip code?
I've got a customer that wants to allow clients to search for businesses within 5, 10, 20, or 50 miles. Are radius calculations performed using known formulas? The math isn't a problem. I just don't know how to go about it. "jp2msft" <jp2m***@discussions.microsoft.com> wrote in message I believe the most common way to perform this search is to use the Great news:4A59D3D9-C79D-4601-A60C-D8D1BB58315C@microsoft.com... > Where would I go to learn how a radius search using a zip code? > > I've got a customer that wants to allow clients to search for businesses > within 5, 10, 20, or 50 miles. > > Are radius calculations performed using known formulas? > > The math isn't a problem. I just don't know how to go about it. Circle calculation. Actually, I find your question a bit odd. You say "the math isn't the problem," which suggests to me you know which formula to use, so I have to wonder what your question really IS.... Are you trying to a get lat/long from a ZIP code? If so, there may be some free databases out there that provide this info. If not, you'll have to get some commercial package for this, and many of them probably come with distance calculation anyways. On Tue, 09 Jun 2009 08:25:55 -0700, Jeff Johnson <i.get@enough.spam> wrote:
Show quoteHide quote > "jp2msft" <jp2m***@discussions.microsoft.com> wrote in message Or, more precisely, "_a_ great circle calculation". Because the planet > news:4A59D3D9-C79D-4601-A60C-D8D1BB58315C@microsoft.com... > >> Where would I go to learn how a radius search using a zip code? >> >> I've got a customer that wants to allow clients to search for businesses >> within 5, 10, 20, or 50 miles. >> >> Are radius calculations performed using known formulas? >> >> The math isn't a problem. I just don't know how to go about it. > > I believe the most common way to perform this search is to use the Great > Circle calculation. [...] isn't a mathematically perfect shape, there is no mathematical formula that gives an _exact_ answer to the question of "distance between two points on Earth". But there are a number of variations on estimating that number, depending on the degree of precision one requires. Pick the one that seems more appropriate for your purposes. I agree with Jeff...the original question is unclear. If the math isn't the problem, then what is? And how is it a C# question? Pete If memory serves, MapPoint can make that kind of 'maximum driving distance
of ... miles (km), from a point' (which can be a postal code), but you get it through the UI, or by using VBA, and the result is graphical, over MapPoint map. If the OP uses MapPoint (as application or its COM-control), then that is a matter to use automation, if not, an additionnal question is 'and in what format do you want the answer' ? I haven't much experience with the specifics involved, so I can't really be more useful in that matter, though. Vanderghast, Access MVP Show quoteHide quote "Peter Duniho" <NpOeStPe***@nnowslpianmk.com> wrote in message news:op.uu9o3ftp8jd0ej@macbook-pro.local... > On Tue, 09 Jun 2009 08:25:55 -0700, Jeff Johnson <i.get@enough.spam> > wrote: > >> "jp2msft" <jp2m***@discussions.microsoft.com> wrote in message >> news:4A59D3D9-C79D-4601-A60C-D8D1BB58315C@microsoft.com... >> >>> Where would I go to learn how a radius search using a zip code? >>> >>> I've got a customer that wants to allow clients to search for businesses >>> within 5, 10, 20, or 50 miles. >>> >>> Are radius calculations performed using known formulas? >>> >>> The math isn't a problem. I just don't know how to go about it. >> >> I believe the most common way to perform this search is to use the Great >> Circle calculation. [...] > > Or, more precisely, "_a_ great circle calculation". Because the planet > isn't a mathematically perfect shape, there is no mathematical formula > that gives an _exact_ answer to the question of "distance between two > points on Earth". But there are a number of variations on estimating that > number, depending on the degree of precision one requires. Pick the one > that seems more appropriate for your purposes. > > I agree with Jeff...the original question is unclear. If the math isn't > the problem, then what is? And how is it a C# question? > > Pete Sorry this has taken so long. Our Group Policy blocks Outlook Express and the
proxy causes the website version to be even flakier than it already is. I did see the messages as they were posted, though. I just can't seem to make the Reply window work. It always times out. Anyway, I have degrees in mathematics and physics, so the math isn't a problem (does that make sense now?). I'm not afraid of the math, in other words. I do not have MapPoint. What I need is to enable someone to enter their zip code and select their radius, and I can pull up the list of available locations within their area. So many websites out there do this now that it must be trivial to do, right? Show quoteHide quote "vanderghast" wrote: > If memory serves, MapPoint can make that kind of 'maximum driving distance > of ... miles (km), from a point' (which can be a postal code), but you get > it through the UI, or by using VBA, and the result is graphical, over > MapPoint map. If the OP uses MapPoint (as application or its COM-control), > then that is a matter to use automation, if not, an additionnal question is > 'and in what format do you want the answer' ? I haven't much experience > with the specifics involved, so I can't really be more useful in that > matter, though. > > > Vanderghast, Access MVP > > "Peter Duniho" <NpOeStPe***@nnowslpianmk.com> wrote in message > news:op.uu9o3ftp8jd0ej@macbook-pro.local... > > On Tue, 09 Jun 2009 08:25:55 -0700, Jeff Johnson <i.get@enough.spam> > > wrote: > > > >> "jp2msft" <jp2m***@discussions.microsoft.com> wrote in message > >> news:4A59D3D9-C79D-4601-A60C-D8D1BB58315C@microsoft.com... > >> > >>> Where would I go to learn how a radius search using a zip code? > >>> > >>> I've got a customer that wants to allow clients to search for businesses > >>> within 5, 10, 20, or 50 miles. > >>> > >>> Are radius calculations performed using known formulas? > >>> > >>> The math isn't a problem. I just don't know how to go about it. > >> > >> I believe the most common way to perform this search is to use the Great > >> Circle calculation. [...] > > > > Or, more precisely, "_a_ great circle calculation". Because the planet > > isn't a mathematically perfect shape, there is no mathematical formula > > that gives an _exact_ answer to the question of "distance between two > > points on Earth". But there are a number of variations on estimating that > > number, depending on the degree of precision one requires. Pick the one > > that seems more appropriate for your purposes. > > > > I agree with Jeff...the original question is unclear. If the math isn't > > the problem, then what is? And how is it a C# question? > > > > Pete > jp2msft <jp2m***@discussions.microsoft.com> wrote:
>... No. It's not a math issue. You need a database that gives you the>I do not have MapPoint. > >What I need is to enable someone to enter their zip code and select their >radius, and I can pull up the list of available locations within their area. > >So many websites out there do this now that it must be trivial to do, right? lat/long of the center of each zip code. This cannot be computed -- you have to get a database from somewhere, like the postal service. Then, you need a service that takes a street address, city, and state, and converts THAT to a lat/long. Again, there are places you can subscribe to that provide that service. Once you have that info, then of course it's (nearly) trivial to determine the distance between two lat/long pairs. -- Tim Roberts, t***@probo.com Providenza & Boekelheide, Inc. On Fri, 12 Jun 2009 20:26:01 -0700, jp2msft
<jp2m***@discussions.microsoft.com> wrote: > [...] It is trivial in the sense that the math is simple. In fact, for your > What I need is to enable someone to enter their zip code and select their > radius, and I can pull up the list of available locations within their > area. > > So many websites out there do this now that it must be trivial to do, > right? purposes it's unlikely you need a very accurate great circle calculation. Even one that assumes the Earth is a perfect sphere is probably good enough, in spite of the large error that can be present with that approach. The hard part is your database, which will need to include lat/lon information for all possible zip codes, as well as for all "available locations". You may be able to obtain a computer-readable database for the zip code information from the United States Post Office (assuming you're looking for US zip codes, of course...most countries use a term other than "zip code", thus my assumption you're talking about US zip codes). You could subscribe to/license a map database that includes support for translating addresses to lat/lon, but assuming you know in advance the specific "available locations", you may find it more cost-effective to just make your own database with the lat/lon precalculated. I don't know the licensing terms, but it's possible you could use the Google Maps Javascript API to do the initial lat/lon calculations, to be stored in your database. Google Maps can convert any US zip code or address to a specific lat/lon for you. Of course, the specifics of that are off-topic here. You'll need to research that on your own somewhere else. Likewise the great circle calculation. But, I know for a fact that there's a lot of examples available online for that. Just Google it. :) Pete |
|||||||||||||||||||||||