Where to get postcodes and map them to distances?
March 15, 2005 5:16 AM Subscribe
I'd like to store people's postcodes and work out distances between them. I think I need a postcode-to-coordinates database, and then a way of working out the distances...
So, two questions really:
1. Where can I get a database mapping postcodes to latitude and longitude (or some other better co-ordinate system)? Free is the best price, but not essential, and the UK is the most important place to cover, but as many as possible would be nice.
2. Once I had such a thing, how would I go about working out the distances between postcodes with it?
PS. This is for a free project, not a business or my job or anything.
So, two questions really:
1. Where can I get a database mapping postcodes to latitude and longitude (or some other better co-ordinate system)? Free is the best price, but not essential, and the UK is the most important place to cover, but as many as possible would be nice.
2. Once I had such a thing, how would I go about working out the distances between postcodes with it?
PS. This is for a free project, not a business or my job or anything.
Sorry, can't help with the first part, but the answer to the second part of your question is:
Cartesian Coordinates.
The system of latitude and longitude is really just a graph that's set up like a simple piece of graph paper in a high school algebra/trig class.
Most people don't like learning about applied math though, so here's a link to a javascript page that will calculate the distance for you (in miles, km, and leagues):
Surface Distance Between Two Points of Latitude and Longitude
posted by chota at 6:09 AM on March 15, 2005
Cartesian Coordinates.
The system of latitude and longitude is really just a graph that's set up like a simple piece of graph paper in a high school algebra/trig class.
Most people don't like learning about applied math though, so here's a link to a javascript page that will calculate the distance for you (in miles, km, and leagues):
Surface Distance Between Two Points of Latitude and Longitude
posted by chota at 6:09 AM on March 15, 2005
This site gives you a csv file of postcodes and their latitude and longitude.
posted by ralawrence at 6:24 AM on March 15, 2005
posted by ralawrence at 6:24 AM on March 15, 2005
Oh and this site gives you ASP code to work out the distance. ASP is essentially a basic-like language and so it's very easy to understand what they're doing and convert it into your choice of language.
Hmm, I think I might have a go at doing it myself.
posted by ralawrence at 6:28 AM on March 15, 2005
Hmm, I think I might have a go at doing it myself.
posted by ralawrence at 6:28 AM on March 15, 2005
I have a zipcode database in a format suitable for reading into a database, and I also have the math pretty much worked out, and code for it. It's in a language most people don't use (tcl) but I could probably throw up a web page with the file, some info on the math, etc, if anyone is interested.
posted by RustyBrooks at 7:15 AM on March 15, 2005
posted by RustyBrooks at 7:15 AM on March 15, 2005
OK, I threw something quickly together. Try this out:
My zipcode thingy.
It has a CSV file, suitable for loading into excel or a database, the code (which is pretty well commented), and a quick example where you can look up some zip codes and find out how far away you are from me.
Which reminds me -- mathowie must have something like this since he has something that shows how far other users are from you.
posted by RustyBrooks at 7:50 AM on March 15, 2005
My zipcode thingy.
It has a CSV file, suitable for loading into excel or a database, the code (which is pretty well commented), and a quick example where you can look up some zip codes and find out how far away you are from me.
Which reminds me -- mathowie must have something like this since he has something that shows how far other users are from you.
posted by RustyBrooks at 7:50 AM on March 15, 2005
Hmm. I suppose that's possible. He's welcome to steal my zipcodes if he feels like it.
posted by RustyBrooks at 8:29 AM on March 15, 2005
posted by RustyBrooks at 8:29 AM on March 15, 2005
Oh and now that I read the question, I've no idea if my database covers the UK or not. Probably not.
posted by RustyBrooks at 8:30 AM on March 15, 2005
posted by RustyBrooks at 8:30 AM on March 15, 2005
Rusty: It looks like the database only covers the US. However, I'm personally glad you posted it because I was looking for something exactly like that, so thanks!
posted by neckro23 at 8:44 AM on March 15, 2005
posted by neckro23 at 8:44 AM on March 15, 2005
According to this page, the process is called georeferencing or geocoding. This might come in handy for subsequent google sessions...
posted by bachelor#3 at 1:45 PM on March 15, 2005
posted by bachelor#3 at 1:45 PM on March 15, 2005
« Older Wound that could have healed cleanly, but ended up... | Looking for The Roots/The Seed Remix? Newer »
This thread is closed to new comments.
It won't be perfectly accurate due to elevation and the earth's curvature, but it should be damn close.
I remember we found a free zip-lat/long db on the intarweb in about 1998, but I don't remember where. Try the USPS or USGS.
posted by tomierna at 6:08 AM on March 15, 2005