Radius search

Chris Sharman Chris.Sharman@ccagroup.co.uk
Mon, 6 Nov 2000 09:26:16 +0000


>I've been asked to implement a radius search based on Zipcode.  Somdthing
>like find all addreses in the database that are within 100 miles of Zipcode
>80201.  I located a database of Zipcodes with lattitude & longitude
>coordinates and I've found the math to make it work.  The downside is that
>the math requires trig functions that don't seem to be within PowerHouse.

You shouldn't need complicated math: good old Pythagoras is good enough for
small distances (ie approximating to flat & not too much variation in the
length of arc subtended by 1 degree East).

x*x + y*y = z*z

where x, y, z are the sides of a right-angled triangle.

Eg: x is the relative Easting, y is the relative Northing, then z will be the
distance "as the crow flies".

There's no sqrt function either of course, but you could select all with
z*z <= 10000, and put them in distance order.

Chris
_______________________________________________________________________
Chris.Sharman@CCAgroup.co.uk		http://www.ccagroup.co.uk/
CCA Stationery Ltd, Eastway, Fulwood, Preston, Lancashire, PR2 9WS.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.