Skip to content

l5/nz-cities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—ΊοΈ Build Cities CSV from LINZ Functional Urban Area Shapefile

πŸ‘‰ Download the latest CSV file here

This script extracts and transforms New Zealand urban core areas from the 2023 Functional Urban Area 2023 - Generalised dataset into a clean CSV file with stable UUIDs, metadata, and accurate WGS84 centroid coordinates.

The source data is maintained by Stats NZ and Land Information New Zealand (LINZ). It outlines the spatial extent and classification of New Zealand's functional urban areas, grouped by categories such as urban core and commuting zones. This list is derived from official government information and provides a reliable foundation for geographic analysis and urban planning.

πŸ“‚ Output

The output file is:

data/cities_nz.csv

Each row contains:

  • uuid: Stable UUID (regenerated only if new FUA ID is found)
  • source_id: FUA 2023 ID
  • name: Urban area name
  • intermediate_category: Urban category (e.g. Urban core)
  • type: Type code
  • type_name: Type label
  • land_area: Raw land area value
  • area_sq_km: Area in square kilometers
  • override_name: Reserved for future manual overrides
  • latitude, longitude: WGS84 centroid (calculated from NZTM2000)

🧰 Requirements

  • Node.js (v18+ recommended)
  • Docker or Podman

The following npm modules are used:

πŸš€ Usage

From the project root, run the script using Podman:

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

This will:

  • Read the shapefile located at data/urban-nz/functional-urban-area-2023-generalised.shp
  • Generate or update data/cities_nz.csv with urban core areas
  • Preserve UUIDs across runs by looking up existing entries

πŸ“Œ Notes

  • Only areas classified as Urban core are included.
  • Coordinates are converted from NZTM2000 to WGS84 using proj4.
  • UUIDs remain stable for existing source_id entries.

πŸ“„ License & Attribution

This work uses the LINZ dataset available under the Creative Commons Attribution 4.0 International License.

Β© Land Information New Zealand (LINZ) and Stats NZ, 2023. Contains data sourced from the Functional Urban Area 2023 - Generalised dataset.

Project source licensed under the MIT License.

About

List of Cities in New Zealand (CSV)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published