Link to home
Start Free TrialLog in
Avatar of leap29
leap29Flag for Afghanistan

asked on

Radius Search From a Postcode

I'm trying to implement a radius for areas in miles around a certain  post code.  I have a table in my DB called locations that contain the columns easting and northing.  How do I use these to search for all the locations with a 5 mile radius of a certain postcode???

I have looked at all the posts here and there is loads of different codes to work out distance between two points but I can't work out how to adapt it to do what I want it to do.

Is there a post that covers this if so can you point me in the direction of it? If not could you please give me an idea how I should go about this mind boggling task!

Thanks
Avatar of adathelad
adathelad
Flag of United Kingdom of Great Britain and Northern Ireland image

I've done this myself before, easiest way to explain is via this example:

http://www.ordnancesurvey.co.uk/oswebsite/aboutus/reports/misc/calculate.html
all you need then, is to wrap up the calculation in a function that accepts the northings and eastings of 2 locations and returns the result of the calculation which you can then slip into your query
Avatar of Dirk Haest
Avatar of leap29

ASKER

"all you need then, is to wrap up the calculation in a function that accepts the northings and eastings of 2 locations and returns the result of the calculation which you can then slip into your query"
Do you have an example of how to do this??
ASKER CERTIFIED SOLUTION
Avatar of adathelad
adathelad
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial