views:

186

answers:

2

Hello

I'm currently building a web app for a UK company with many outlets in the UK. I want to implement a 'find my nearest' based on the following.

  1. Postcode
  2. Landmarks

So the user could enter either to get a list of their nearest. I've done this before using postcode data in a database and then using Pythagoras to figure out the nearest ones.

Ideally I would like to use a web service to do this but I cant seem to find any at all.

My question would be - What would be the best way to implement such a service ? 3rd party app or do it myself. ?

+1  A: 

There are various options listed very sanely and even with UK specific notes here

You should externalize the reverse geocoding (from postcode to coordinates) and then intersect the stores location with the coordinates of the postcode or location to get the nearest one. There is another example here.

The reason to externalize the geocoding is to relieve you from the need to update such a database continuously which might not even be feasible given your constraints.

Vinko Vrsalovic
+1  A: 

Take a look at the Geokit gem, for ideas if not for implementation.

Also, in the UK you can get quite markedly incorrect answers if you use Pythagoras. You really want Haversine, and someone else has almost certainly done the hard work no matter what platform you're on.