Home > Postcodes > New Zealand Postcode Database (V2)

New Zealand Postcode Database (V2)

September 14th, 2007 Leave a comment Go to comments

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.

Categories: Postcodes Tags:
  1. December 5th, 2008 at 13:54 | #1

    @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.

  2. December 5th, 2008 at 13:57 | #2

    @Chris

    This is the break down that I get from the database:
    359 – urban
    692 – rural
    687 – PO Box

    1738 postcodes

  3. December 5th, 2008 at 13:59 | #3

    @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.

  4. December 5th, 2008 at 14:05 | #4

    @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.

  5. Colin
    January 6th, 2009 at 15:47 | #5

    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?

  6. Jo
    March 3rd, 2009 at 13:02 | #6

    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?

  7. Melanie
    August 17th, 2009 at 10:40 | #7

    Hey, how current is this postcode list?

  8. Will
    August 24th, 2009 at 10:09 | #8

    Just dropping a note of thanks, awesome to see helpful projects like this, keep up the good work.

  9. Lee
    September 1st, 2009 at 19:55 | #9

    Thanks for your efforts, appreciate it

  10. Charles Sitwell
    October 23rd, 2009 at 16:02 | #10

    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 :-)

  11. Sam
    October 28th, 2009 at 21:47 | #11

    Thanks very much for the DB. It really helped a lot!!!!!!!!!!!!
    You are a legend mate!

  12. Sam
    October 28th, 2009 at 22:05 | #12

    Is there a way to determine the region by postcode e.g starting with a particular digit?

  13. Alex
    April 12th, 2010 at 16:00 | #13

    You are a star. Saved me a heap of time and money

  14. April 25th, 2010 at 19:43 | #14

    Thanks heaps. Do you have a phone number db to by any chance?

  15. June 17th, 2010 at 23:03 | #15

    You. Are. A. God.

    Thank you so much!

  16. June 17th, 2010 at 23:16 | #16

    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!

  17. Joe
    June 30th, 2010 at 16:57 | #17

    Or you can use this to extract the postcode from the NZ Post PDF
    http://www.srmiller.net/nzpostcode/nzpostcode2csv.zip

  18. Sue
    July 27th, 2010 at 19:14 | #18

    I would love a NZ postcode csv file with simply the postcode and the region.
    If anyone has one, can you please let me know how I get it.
    Thanks

  19. Kereama Williams
    October 10th, 2010 at 10:00 | #19

    Thanks great job you have done

  20. Matt
    November 17th, 2010 at 07:26 | #20

    Legend! Thanks so much for putting this together

  21. Scoro
    February 8th, 2011 at 20:44 | #21

    I’ve done a bit of playing and

    A) converted it into Postgresql sql
    B) converted the addrinfo column into a streetMin and streetMax column

    if anyone wants it — the current streetMin and streetMax are in Postgres format, but its fairly trivial for me to turn them into CSV or mysql if the desire was there

  22. GregA
    March 22nd, 2011 at 16:29 | #22

    Hi, I needed a list like this for my company, but I am donating to you out of my own pocket, purely from admiration and personal thanks.

  23. Owen
    April 15th, 2011 at 15:04 | #23

    @Scoro
    Scoro: Any chance of a copy? Please send to o.m.watson@gmail.com. Ta!

  24. Owen
    April 15th, 2011 at 15:05 | #24

    Woops, could I have it in csv?

  25. Chris
    July 5th, 2011 at 21:22 | #25

    Hi,

    Does anybody have a csv file of NZ postcodes to regions that they could send me. Would be greatly appreciated. I tried looking at the link http://www.srmiller.net/nzpostcode/nzpostcode2csv.zip but it doesn’t seem to work anymore

  26. July 8th, 2011 at 23:17 | #26

    You can look up and download NZ Postcodes (in the new format) with city and very precise latitude and longitude data.

  27. Steve Sims
    July 11th, 2011 at 16:53 | #28

    Hi there could I also get a copy of the CSV please to steve@sims.gen.nz
    Thanks

  28. October 26th, 2011 at 12:14 | #29

    Hey thanks for doing such a great job with this!!

  29. Flashmob
    December 8th, 2011 at 18:04 | #30

    Here’s a query for combing all 3 tables in to one table:

    INSERT INTO customer_nz_postcodes
    ( postcode, suburb, town, rural_d )

    select postcode, suburb, area as town, null as rd FROM suburbs
    UNION
    select postcode, NULL as suburb, town, rd FROM rural
    UNION
    Select postcode, lobby as suburb, city as twon, null as rd FROM boxes

    (tip: Disclaimer: I’m not from NZ, is it reasonable to generalize like this?)

  30. Josh
    May 15th, 2012 at 14:30 | #31

    IF YOU’RE TRYING TO SAVE AND OPEN THE CSV FILE AND GETING AN ERROR –

    DELETE ‘.CSV’ OUT OF FILE NAME BEFORE SAVING.

    SAVE AS – ‘nzpostcodes_v2.zip’

    DON’T SAVE AS – ‘nzpostcodes_v2.csv.zip’

  31. Richard
    May 26th, 2012 at 19:31 | #32

    Given this appears to be the hub for NZ Post Code data ;-)
    A csv of the current Post Code Directories can be downloaded here http://dl.dropbox.com/u/3425612/NZPostCodes/NZPostcodesApril2012.xls
    The source NZ Post pdfs show a creation date of May 2011 in the properties so I’m guessing the data Noodle is providing is somewhat dated/inaccurate/incomplete.

  32. Joe Rossi
    July 13th, 2012 at 17:27 | #33
  33. Dave Price
    May 17th, 2013 at 00:21 | #34

    I’m looking for a list of old postcode and their ‘rough’ match to the new ones for a uni assignment. I’m trying to geocode postcodes, but have a list of 760 codes which don’t match NZ Posts current codes. Exact matches are not needed as I’m doing it to the TA (Territorial authority) area, so the old code for Hamilton – 2001 could match up to any of their 7 new codes 3200-3216 etc. Any help would be appreciated!

  34. Hamish
    November 5th, 2013 at 20:06 | #35

    Has anyone successfully extracted the NZ Post *Auckland* postcode directory from .PDF?
    I get an ‘Error converting PDF’ message when I try (despite renaming the file to the expected postcodedirectory_nomaps.pdf). No probs with Northland and NZ-wide directories though…

    http://www.nzpost.co.nz/sites/default/files/uploads/shared/postcodedirectories/auckland-directory.pdf

    Thanks for this extremely useful utility!

  35. May 29th, 2014 at 23:12 | #36

    Hi

    I have loaded your csv file into my website https://seek.estate but it is missing a lot of suburbs for NZ. When I try to add listings for NZ, many suburbs around Christchurch and the South Island are missing. Any chance of an update soon?

Comment pages
1 2 17
  1. September 14th, 2007 at 22:50 | #1