search routine based on postcode (in australia)

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

search routine based on postcode (in australia)

Post by robster »

Apologies if this is the incorrect forum to ask this question. I'm basically asking for advice on how this kind of thing works.

I have a set of users (car nuts) and i want to have them have the ability to search each other. Currently i have their Postcodes and location (they are legit postcodes as I do a check when they signup).

This is how the data looks (I'm using MySQL and PHP):

Code: Select all

id - postcode - location - popularity
1 - 4000 - Brisbane (QLD) - 0
So not only do I have the postcode I also have the description of the location (the (QLD) is the state, in this case, Queensland)).

So the question is, how can I determine how far away postcode 4000 is from 4001 (brisbane city to a brisbane suburb), or 4000 from 2000 (brisbane to sydney)?

I'm going to offer them the standard, find me a car nut with X car who is Y Kms from postcode Z.

Any advice lapped up, this one's going to REALLY stretch me. ;)


Rob

EDIT: I did find this: http://www.findmap.com.au/pcdist.html but am not sure if it's the way to go, first of all it's massive, and secondly, I'd like to see if i CAN do it myself before going this route.... If I have to I have to, but 5million records in a database file to keep track of distances seems, intense.... (shrug)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you only need to get the long & lat of each postal code, then a little bit of math and presto, distance!
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

feyd wrote:you only need to get the long & lat of each postal code, then a little bit of math and presto, distance!
ahem... :) only ;)

I am guessing that database I pointed at in the bottom of the original post is the way to go then? It just seems like a LOT of entries in the database, and it would therefore appear to make searching slow (but perhaps I am wrong).
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

I didn't check that website (sorry, I would but my internet is dead slow), but if it contains longitude and latitude details of the locations you need just go ahead and jump on it.
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

It actually contains EVERY postcode in australia and every OTHER postcode in australia, then the distance.

The database is HUGE. They want AUD$550 for it.

Basically, there are 5 million records that look like this:

Code: Select all

Postode Source, Postcode Destination, Kilometers difference (as crow flies)
2000,2006,3
2000,2007,2
2000,2008,3
2000,2009,1
2000,2010,2
2000,2011,1
2000,2015,5
2000,2016,3
2000,2017,4
2000,2018,7
2000,2019,10
etc,etc,etc
User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

robster wrote:It actually contains EVERY postcode in australia and every OTHER postcode in australia, then the distance.

The database is HUGE. They want AUD$550 for it.

Basically, there are 5 million records that look like this:

Code: Select all

Postode Source, Postcode Destination, Kilometers difference (as crow flies)
2000,2006,3
2000,2007,2
2000,2008,3
2000,2009,1
2000,2010,2
2000,2011,1
2000,2015,5
2000,2016,3
2000,2017,4
2000,2018,7
2000,2019,10
etc,etc,etc
Thats insane. I'm sure there is an easyer way to do it.
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

omg, if there is, somebody please tell me! :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

distances between longitude & latitude coordinates is fairly simple. If you can get the database of all the coords of each area, you can do the calculation.. as I said before..

http://jan.ucc.nau.edu/~cvm/latlon_formula.html
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

I have looked into it, but the Aus Govt seems to want to charge well over $1000 for it, it feels like such a scam. Near all their other data is free except the good bits of data ;)

Such is the way. I'll keep hunting for that data then. Seems like that's the option.


Thanks again,

Rob
Post Reply