On Wed, Aug 10, 2011 at 04:45:41PM +0100, Paul Waring wrote: > You can use the MaPit API to fetch the latitude/longitude of a postcode:
> http://mapit.mysociety.org/ > > I have a simple PHP class which does the bulk of the work for you: And if you're not a programmer, you should be able to put your data in e.g. Google Refine and use its functions. Someone gave a tutorial to fetch council information, though you can fetch co-ordinates as easily: http://onlinejournalismblog.com/2010/12/16/adding-geographical-information-to-a-spreadsheet-based-on-postcodes-google-refine-and-apis/ (use escape() on the postcode rather than the split/join). Be sure to set the throttle to a few seconds to prevent being blocked. > Once you've got the coordinates of two postcodes (ministry and > donor/volunteer), you can calculate the distance between them. There's a > variety of methods available, depending on the level of accuracy you > want and whether the points are likely to be close to each other. The > Haversine formula is a reasonable place to start: If it's Great British postcodes, surely easier to fetch the easting/ northing, then calculating the distance from a fixed point is just Pythagoras :) ATB, Matthew > _______________________________________________ developers-public mailing list [email protected] https://secure.mysociety.org/admin/lists/mailman/listinfo/developers-public Unsubscribe: https://secure.mysociety.org/admin/lists/mailman/options/developers-public/archive%40mail-archive.com
