Screenshot of Infra NZ

InfraNZ

Winter seems to be the time when most local hackathons occur. Govhack 2023 was no different, spanning the weekend from 18 Aug to 20 Aug. Having been to a few hackathons in Auckland already, I was seeing many familiar faces. Following kick-off, teams quickly formed around a short list of local problems.

Our team: Walter Lim, Connor Hare, Oliver Chamberlain, Tony Cui, Filip Jerkovic, Jerry Lei, and Alex Verkerk. The problem point, Digital Twin Modeling. Jerry and Walter, employees at Infinity Studio (geotechnical engineering software), were already well versed with this specific problem. We quickly narrowed down on a harrowing concern with council public infrastructure.

An issue with councils

Councils own extensive amounts of public infrastructure. For example, Auckland Council maintains over 1,000 square kilometres of infrastructure on-behalf of 1.5 million people. Watercare (Auckland Council Water) alone is responsible for over 9,000 kilometres of fresh water pipe, and more for stormwater and sewage.

In isolation, this already sounds like a monstrous task to stay on top of, but introduce the fact that some of this infrastructure was built in the 1800's, and half of it isn't accurately documented; the nightmare grows.

During the January 2023 floods, Watercare was unaware of its stormwater throughput capacity, or which areas it expected to be catchments. As Auckland grows and develops, more of its natural flood resitance is lost. New construction concentrates stormwater to choke points at property boundaries, and its at these boundaries that responsibility shifts to a "none the wiser" Watercare. Often, surveyors are hired to survey the same land that was surveyed just months prior. This survey data rarely extends beyond property boundaries. Simply put, record keeping for publicly owned infrastructure is poor at best.

A problemed solution

The plan is simple. A GIS (geographic information system) that aggregates information about buildings, utilities, and public projects. The tool should allow trusted professionals to provide additional data about aging pieces of city infrastructure. Over time, collected data would provide a more complete view of the capabilities of a region's public infrastructure. New construction would be able to leverage this to reduce costs, prevent catastrophes, and more accurately plan new projects. Councils could be alerted to failing pieces of infrastructure, and understand when components of their network are no longer adequate for expected demand.

Demonstrating it in 48 hours

This is the part where we start to cut corners. Hackathons are about delivering a proof of concept, we focus on detailing an organisation's problem and solution. The software, in this case infra.nz, exists to illustrate our point. It helps a viewer better understand what we propose to deliver.

Naturally, after many hackathons working with GIS, we've become "the map people". To get the ball rolling, Tony scaffolded the repo and I got to work dropping in the map.

We used react-map-gl to create a mapbox map using maplibre-gl. This is the stack that we have experience with, so we knew it could do what we needed. The nature of a hackathon means that code quality is almost irrelevant.

Where we're going, we don't need maintenance.

Click to reveal...

Then, we add each piece of data to the map using a DeckGLOverlay. DeckGL does all of the heavy lifting, allowing us to go as far as loading 3D Objects (obj) in at various points on the map using latitude and longitude coordinates. For the sake of completeness, an example is provided in the spoiler below.

Click to reveal...

There are various data sources in this application, the first of which is fire hydrant locations and statuses. This information is provided as GeoJSON for the entire Auckland region, totalling over 70Mb. To prove our point, we wrote a quick script to reduce the data down to approximately the Auckland central suburb. A similar transformation was performed for the water pipe locations, which is provided in a similar format (both by Watercare).

The air quality dataset provided measurement points for air qualities. That is, 25,000+ PM10 concentration values recorded at specific coordinates around Auckland. Along with a dataset of Auckland suburb borders, the client identifies the "average coordinate" inside a given suburb, and samples the nearest air quality. This is drawn to the map as a shaded suburb polygon.

The average daily traffic and coastal hazard datasets are relatively simple direct loads of GeoJSON from the council.

Lastly, the internet outage and water outage layer are served via API. During the hackathon, Connor built the Infra NZ API using Rust. The API fetches internet outages from a public Chorus API (CORS protected), and present/future water outages from a public Watercare API (CORS protected). The API also serves CRD endpoints for "reports", stored in a PostgreSQL table deployed quickly via AWS Lightsail.

Conclusion

During this hackathon, I tried to take a back seat in development. Often times, I'm the most experienced engineer in the team, and that rarely leaves good opportunity for the other members to contribute significantly. Instead, I focus on practicing alternative skills such as project management. I'm always available to support team members with anything they may struggle with. Afterall, I am well known for my ability to make React do things it is not supposed to do.

All in all, we built a fun GIS tool for a variety of Auckland local data sources. Of course, its not particularly resilient. The problem we aimed to solve is one that deserves a lot more attention than 48 hours, and its unlikely that our proposal would come near solving it. The fundamental issues our construction, engineering, and public service industries face are extensive, and poor access to their own data is a large contributing factor.

I'm certainly looking forward to Govhack 2024.