Side project, running on this site
Toronto, by its trees
The map at the top of the home page. It draws every street tree the City of Toronto has on record in central Toronto, compressed to six bytes each and painted on a canvas. Tap or hover one to see what it is, whether it's native to Ontario, and roughly how old it is, and every tree of its species lights up.
- Role
- Designer and developer
- Data
- City of Toronto Street Tree Data
- Size
- 342,748 trees, six bytes each
- Draws on
- Canvas, no map library


- 1
The card names the tree, its botanical name, and its trunk size, all read from the same six bytes that place it on the map.
- 2
Every ginkgo in view turns lime and the rest of the city dims, so one species reads as a pattern across the streets.
- 3
Trees under the headline are drawn at a quarter of their usual opacity, so the city stays visible and the copy stays readable.
Source: annachester.dev
The problem
Most people walk past street trees without noticing how much they do: shade, a cooler block on a hot day, and a more beautiful street. A trunk's size even hints at how long the tree has stood there, and so at how old the neighbourhood is. I wanted the first thing on my site to be my city, drawn only from its trees.
The catch is size. The city's street tree file has 688,335 rows of CSV, far too heavy to send to a browser as it is.
What I built
A Node script reads the file, keeps the trees inside a central Toronto window, and packs each one into six bytes: two for x, two for y, one for its species, and one for its trunk diameter. The page draws them on a canvas with no map library, and a grid index finds the nearest tree under the cursor.
The hard parts
Fitting 342,748 trees into something a page can load.
Six bytes a tree. Positions are quantised to a fixed grid, and species are ranked so the top 254 get their own index and the rest share one. The whole window is about 2 MB before compression.
Finding the tree under the cursor without checking all of them.
Trees are bucketed into a grid when the page loads, so a hover or tap checks the few cells around the cursor instead of 342,748 trees.
Saying a tree is native only when a source says so.
Native status comes from the Government of Ontario's Tree Atlas, which lists 79 trees native to the province. A species gets a label only when that list backs it up, so hybrids, records that name only a genus, and native shrubs the list leaves out get no label at all. Across the map, 143,237 trees are species native to Ontario and 150,942 are not.
Estimating a tree's age from its trunk, and being clear it's an estimate.
The city records each tree's trunk width, not its age. The USDA Forest Service has published equations, species by species, that estimate a street tree's age from its trunk, fitted to trees whose planting dates were checked. None of their regions is Toronto, so I use the Northeast set from Queens, New York, which covers more of Toronto's common species than any other. A tree only gets an age within the trunk sizes the study actually measured, which works out to about 42% of the map, and the card says it's an estimate. Toronto's winters are colder, so many of these trees may well be older than the card says.
Keeping a headline readable over a dense map.
The renderer knows where the copy sits. Trees inside those zones draw at a quarter of their usual opacity, so the text stays legible and the city stays in view.
The result
The map is the first thing anyone sees on my site, and it's built entirely from open city data. Tap or hover any tree and you can see what it is and how many like it share the streets around it.
Built with
Node.js for the packing script, a TypeScript canvas renderer, City of Toronto open data, the Government of Ontario's Tree Atlas, and the USDA Forest Service's Urban tree database (McPherson, van Doorn, and Peper, 2016). Contains information licensed under the Open Government Licence – Toronto.
Next project
Banu Beauty
A live store that ships to seven countries. I designed, built, and redesigned it, and the founder updates it herself from her own studio.
Have somethingthat needs building?
If you have an idea you want built, or a project you'd like to talk through, I'd love to hear about it. I'm based in Toronto, and distance isn't a problem.