π 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.
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 IDname: Urban area nameintermediate_category: Urban category (e.g. Urban core)type: Type codetype_name: Type labelland_area: Raw land area valuearea_sq_km: Area in square kilometersoverride_name: Reserved for future manual overrideslatitude,longitude: WGS84 centroid (calculated from NZTM2000)
- Node.js (v18+ recommended)
- Docker or Podman
The following npm modules are used:
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.csvwith urban core areas - Preserve UUIDs across runs by looking up existing entries
- Only areas classified as Urban core are included.
- Coordinates are converted from NZTM2000 to WGS84 using
proj4. - UUIDs remain stable for existing
source_identries.
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.