On 10/08/11 16:34, Mark Simpkins wrote:
I am now doing a bit of volunteer work for the Ministry of Stories
(http://www.ministryofstories.org/) and we have a couple of databases
(volunteers and donors) and we want to do some processing on their
postcodes.

We want to find how far they are from the ministry etc.

Is there anything we can use mySociety / mapit style for this do you think?

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:

https://github.com/pwaring/mapit-lookup

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:

http://en.wikipedia.org/wiki/Haversine_formula

If you're using PHP:

http://code.google.com/apis/maps/articles/phpsqlsearch.html

--
Paul Waring
http://www.pwaring.com

_______________________________________________
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

Reply via email to