New Zealand Postcode Database (V2)
I’ve done a bit of work on the database, added a bit of information and corrected mistakes.
Thanks to Owen and others for help with the data.
If you find this data useful, please donate.
What’s new in V2
- More accurate
- Added GPS co-ordinates
- Added PO Boxes and Private Bags
- Added Rural postcodes
- Removed regions (as some datasources labeled a city/town as one region and others differed.)
I’ve also taken the opportunity to include CSV and MSSQL formats, as well as MySQL.
History
I originally created the database as I needed street and suburb data for a project I was doing. No one else was stupid enough to spend that much time on it, so I took it on. NZ Post still has their PAF data, but are unlikely to release a free database of the postcodes.
Original Post
More info on NZ Addresses
Downloads
MySQL
nzpostcodes_v2.sql.gz (655KB)
nzpostcodes_v2.sql.bz2 (445KB)
CSV
nzpostcodes_v2.csv.zip (1.07MB)
All efforts have been made to ensure that there are no errors, but there are no guarantees, if you need 100% accurate data please buy NZ Post’s PAF data.
[UPDATE 20/04/08]
As a few people have pointed out, there was no suburb data in the MySQL database version of the postcode database. This has now been fixed. Sorry about the problems and how long it’s taken me to get around to fixing it.
@Richard
Thanks for the comment, but this is what I did with v1. It was horribly inaccurate and took me ages to fix up import problems as PDF->text didn’t work well.
The database I have now has a lot more information including long/lat coords for streets, which cannot be parsed easily from the PDF.
@Chris
This is the break down that I get from the database:
359 – urban
692 – rural
687 – PO Box
1738 postcodes
@Peter
If you use the rural table from the MySQL db then you’ll find that 3288 is RD8 Hamilton. CSV file only has urban street addresses.
@Brett
Thanks for this, I will write a script to fix these up, they should be pretty easy to spot. I’ll try and get an update this weekend if I get time.
All great work. NZ post don’t make it easy to extract the data. The PDFs ( from NZ post) can be by Region but you have not added it as a field. This would be the gold, as most reporting is done by region. Are you able to add this field to the data?
This is fantastic, and I really appreciate your efforts. The postcodes are one peice of the puzzle for a project I am working on, the other being SNZ mesh blocks. Are you able, or do you know anywhere, where these two have been aligned?
Hey, how current is this postcode list?
Just dropping a note of thanks, awesome to see helpful projects like this, keep up the good work.
Thanks for your efforts, appreciate it
This is just what I was hoping NZPost would provide when they introduced the new system. Since then I have been putting off the evil day when I would have to do it myself.
My interest is I’ve set up databases for a number of not-for-profit groups to which I belong, with a button to look up the Postal code and insert it after they have typed in the address of a member.
To use this data in the same way, would I need to pay and to whom and what about NZ Post copyright. I don’t want any suprises down the track. So I’m asking before starting what will still be quite a lot of work
Thanks very much for the DB. It really helped a lot!!!!!!!!!!!!
You are a legend mate!
Is there a way to determine the region by postcode e.g starting with a particular digit?
You are a star. Saved me a heap of time and money
Thanks heaps. Do you have a phone number db to by any chance?
You. Are. A. God.
Thank you so much!
To everyone who wants to associate suburbs with region (no matter the accuracy) do the following;
1) Import the V1 version of the postcode database
2) Import the V2 version of the postcode database
3) Add a column to the suburbs table from the v2 database called regionid INT(11)
4) Run the following SQL (note I appended “location_” to the start of all my V2 tables, and renamed the V1 table postcodes_v1):
UPDATE location_suburbs, location_regions, postcodes_v1 SET location_suburbs.regionid = location_regions.regionid WHERE location_suburbs.suburb = postcodes_v1.suburb AND postcodes_v1.region = location_regions.regionid
Hope this helps… all I’m looking for is a nice way to let people who register on a site pick a region and suburb!
Or you can use this to extract the postcode from the NZ Post PDF
http://www.srmiller.net/nzpostcode/nzpostcode2csv.zip