Skip to content

l5/nz-suburbs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NZ Suburbs & Localities CSV Generator

This project extracts and processes suburb and locality data from an official LINZ shapefile and outputs a clean, deduplicated CSV file (data/suburbs_nz.csv) containing the following information:

  • UUID
  • LINZ ID
  • Suburb/Locality name
  • Additional name
  • Type (Suburb or Locality)
  • Territorial authority
  • Parent name and type
  • Latitude and Longitude (in WGS84)

This is designed for integration into community platforms, location databases, or applications needing accurate NZ suburb/locality geodata.


🚀 Usage

You can run this script using podman (or docker) with the following one-liner:

podman run --rm \
  --network host \
  -v "$(pwd)":/app:Z \
  -w /app/src \
  node:20 \
  bash -c "npm install proj4 shapefile @turf/centroid && node build_suburbs_datafile_from_linz.js"

This will:

  • Download any missing dependencies
  • Read the shapefile from data/suburbs-nz/nz-suburbs-and-localities.shp
  • Generate (or update) the data/suburbs_nz.csv file

The script ensures UUIDs for LINZ IDs are consistent between runs. It re-generates only for newly discovered IDs.


📦 Output

The resulting file is:

👉 data/suburbs_nz.csvclick here to download


📄 Source & Licensing

This work is based on open government data:

Please include attribution to LINZ when using the data in derived products:

Contains data sourced from Land Information New Zealand and licensed for reuse under the Creative Commons Attribution 4.0 International licence.


🛠 Tech Stack

  • Node.js (ESM format)
  • shapefile – reads the shapefile binary
  • @turf/centroid – calculates geometric centroids
  • proj4 – reprojects NZTM2000 to WGS84

🙌 Contributions

Contributions and improvements welcome. Just open a PR or issue on GitHub.


All code is MIT licensed. Data is CC BY 4.0 as outlined above.

About

List of Suburbs in New Zealand (CSV)

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors