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:50 | #1

    @alex
    Regions were very subjective depending on what dataset you look at. I.e. Taupo is sometimes in Waikato, sometimes in Bay of Plenty. If someone can find a list of cities and regions then I can match it up.

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

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

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

    @Chris

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

    1738 postcodes

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

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

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

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

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

    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?

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

    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?

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

    Hey, how current is this postcode list?

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

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

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

    Thanks for your efforts, appreciate it

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

    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 πŸ™‚

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

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

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

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

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

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

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

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

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

    You. Are. A. God.

    Thank you so much!

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

    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!

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

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

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

    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

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

    Thanks great job you have done

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

    Legend! Thanks so much for putting this together

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

    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

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

    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.

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

    Woops, could I have it in csv?

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

    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

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

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

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

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

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

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

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

    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’

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

    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.

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

    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!

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

    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!

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

    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?

  37. Owen
    July 25th, 2014 at 08:43 | #38

    @Seek.estate
    What suburbs are missing?

  38. August 28th, 2014 at 18:01 | #39

    I think I have the same issue as seek.estate. I am just looking for a simple file linking postcode to it’s latitude and longitude. I couldn’t find one so we got the V2 list above. We also fond that many postcodes just didn’t exist. I’ll provide a few examples which I have verified on the NZ Post Postcode Finder.
    1. Pito Street, Raurimu, RD1, Owhango comes up as postcode 3989, but this doesn’t exist in the V2 file.
    2. Kaiwera Raod, Gore comes up as postcode 9772, but in V2 it’s 9710
    3. Moore Road, Wakefield comes up as postcode 7095, but in V@ it’s 7025

    I’ve been really pulling my hair out so would really appreciate any comments or advice.

  39. September 12th, 2014 at 07:30 | #40

    This is over 7 years old now, so I’m sure it’s not very accurate now. I haven’t had the need for the data again so I haven’t bothered to update it. If there’s enough need/call for it then I’ll take another look.

  40. September 17th, 2014 at 10:35 | #41

    @noodles
    I actually need a file that had postcode, locality description and the latitude and longitude for the ‘middle’ of the postcode polygon. It’s seems I have that file now following heaps of emails to and from a contact in NZ Post. Given this has all taken me 3 months, if anyone needs such a file, is there some way they could access it through this site/page (when searching Google, this site still comes up high on the search list, so I think it might be useful)

  41. Jay
    December 20th, 2014 at 05:22 | #42

    @noodles
    Thanks for the work!

    Very much appreciated! Thanks

  42. Malcolm
    December 11th, 2015 at 11:38 | #43

    Just wanted to say this is brilliant. I will organise a donation for you from my current non-profit. Well done supplying this.

  43. Malcolm
    December 11th, 2015 at 11:52 | #44

    Hi Jay
    I’ve matched your postcode file to my data and there are indeed a lot of post codes missing. Will you be updating the file at all? And if not can you suggest somewhere else I might get my hands on a current one.

    Thanks heaps

  44. January 20th, 2016 at 12:09 | #45

    Thanks!

    There is no GPS data in the mysql tables? Anyway that could be added?

  45. Will
    December 14th, 2016 at 07:57 | #46

    Hey @Noodles,

    How current would you say your work here is? I’m not seeing a lot of recent dates at the top of the screen, but I don’t want to do any reinventing of the wheel if I’m playing around with postcodes to get the bits of data I want out of them. Just trying to gauge whether i’m best to grab your work (which looks good), or redo it myself from the Postcode directories? (Like a number of commenters, I’m most interested in REGIONS information which isn’t stored in the CSV version above.)

    What’s your gauge on your database, still current, or best to rewrite?

  46. January 19th, 2017 at 12:49 | #47

    Hi do you have an updated database please!

  47. February 7th, 2017 at 16:14 | #48

    At this point the database is quite out of date. It hasn’t been updated since ~2008. I haven’t had the need for it, so I have tried to seek out new data.

  48. February 7th, 2017 at 16:14 | #49

    Sorry, I don’t have an update for this.

  49. Ryan
    February 16th, 2017 at 12:07 | #50

    Hello,
    So no update means we now have to pay $1000 for the PAF πŸ™ ? Anyone else know where we can get this free? I don’t mind paying once my new build site makes money but to save the cash while it is in development would be nice as I desperately need to invest that in other areas

Comment pages
1 2 17
  1. No trackbacks yet.