Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Wanted: Service Website developer with experience of radius search functionality

Status
Not open for further replies.
Joined
Feb 26, 2008
Posts
108
Reaction score
1
I am looking for a developer to assist me implement a UK radius search.

I already have implemented a PHP solution for a radius search based on a fixed point such as a postcode but what I need is a radius search based on an area such as a town, city, county that has no fixed point.

So for example if someone does a radius search for bristol with a range of 5 miles it needs to include all places within the Bristol boundaries plus anything in the area that is 5 miles outside this area in all 4 directions.

I believe the solution will need to use the bounding box for these location types however I am not sure how to obtain this data.

I have seen loads of UK estate agent sites that have this functionality but cannot find any resources to assist me implementing this myself. I therefore am seeking a developer who has experience of doing this.

Thanks

Paul
 
Could you not cheat slightly? For each town/city, have a lookup table that includes the most central postcode and the approximate radius of the town/city concerned.

Then any lookup is simply:

1. Find town/city name (prompt user for close matches etc)
2. Get postcode
3. Add user's search radius to the town's radius
4. Find everything using the normal postcode search with the new extended radius.

maybe not as accurate, but a hell lot easier than maintaining a list of every postcode at the boundaries of a town.

Steve
 
Thanks for the reply Steve

Problem with your solution is getting the data on the approximate radius of the town or city. There are thousands of villages, towns and cities in the UK so this is not something I could do manually.

I wish I knew how all the estate agent sites do it:)
 
They probably all use one of the PAF databases from Royal Mail or other suppliers which includes boundaries. They would be able to get a lat/lon area for any town/city and then calculate the distance out from those.

A developer wouldn't be able to help much without the right database to start with.
 
Yeah I suspected that is what they use. Didn't realise the PAF includes boundary data though. Does that mean for somewhere like Bristol for example, they provide 4 co-ordinates of the outer points to enable creating a bounding rectangle?

Thanks

Paul
 
I think we ended up doing a pythagoras with the longitude/latitude data - fairly straight forward (and is point to point) - once you've got the data imported into a table correctly you'll be able to suss it quite fast. Remember to add an index to the postcode column though - as if you don't some queries can take a while (think it was 2 million rows last time I checked)

Didn't work with the boundaries as was just calculating distances from a certain point
 
Last edited:
after a quick google, there are two ways this is done. I think the real PAF has a polygon outline of a postal district or postal sector (one of which I think is at the town/city level). This is very detailed obviously as you get the lat/lon for each point on the polygon.

Another method is a database that has a town/city and has a simple rectangle bounding box with the lat/lon for each corner.

The easiest way , if you already have a list of thousands of towns/cities, is to group them in about 5 bands and group them according to approx size and do the distance from central postcode thing. You could go through the big cities and make them more accurate.
 
done this a few times...

theres a few databases about that has lat/long of postcode areas (NW3, SE1, FK10 etc), you simply take the first X characters of the entered postcode and use a calculation to work out the distance :)
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

Latest Comments

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom