How S4 is built and tested

Author

Mohamed Gharbia

Published

October 15, 2026

Blueprint

flowchart TB
  IN[/"SIX OPEN FILES<br/>OpenStreetMap · tax roll · lot outlines · address points<br/>commercial survey 2025 · public places"/]:::data
  IN --> O["OUTLINES<br/>centre in the study area"]:::step
  O --> A["THE ROLL AT ITS ADDRESS<br/>street name + civic number"]:::step
  A --> L["EVERY ROW FINDS ITS BUILDING<br/>its lot first, then its address point"]:::step
  L --> U["USE<br/>roll, then tag"]:::step
  L --> H["SIZE<br/>storeys, dwellings"]:::step
  L --> G["GROUND FLOOR<br/>premises, places"]:::step
  S1[/"S1 walkable streets"/]:::data --> X["ACCESS<br/>an assumption"]:::step
  O --> X
  U & H & G & X --> OUT[/"buildings, places,<br/>unplaced rows, checkpoints"/]:::out
  OUT --> T["tests and maps"]:::test

  classDef data fill:none,stroke:#8a8a8a,color:#e6e6e6
  classDef rule fill:none,stroke:#8a8a8a,stroke-dasharray:4 3,color:#a6a6a6
  classDef step fill:none,stroke:#e6e6e6,color:#e6e6e6
  classDef out fill:none,stroke:#e6e6e6,stroke-width:2px,color:#ffffff
  classDef test fill:none,stroke:#fe83cc,color:#fe83cc

The sources

Source What S4 takes from it
OpenStreetMap, with its building parts building outlines and tags, including tower parts with their storeys; places such as shops and cafés, with opening hours
Ville de Montréal, tax roll (Unités d’évaluation foncière), also with lot outlines (October 2026) each property’s use, storeys, dwellings, year built and floor area, and the land it sits on
Ville de Montréal, Adresse ponctuelle where each street number stands
Ville de Montréal, Locaux commerciaux et statuts d’occupation every ground-floor commercial space in 2025, occupied or vacant
Ville de Montréal, Lieux et bâtiments à vocation publique public places and their opening hours
Situ S1 the streets people can walk on

The city’s files are open under CC BY 4.0, OpenStreetMap under ODbL.

The Concordia NGCI building file gives a height and a use for every building in Montréal. It carries no licence, though, so S4 does not use it, and I publish nothing made from it until one is granted; it also records a condo tower such as 2199 rue Ann, 76 m tall, as one dwelling. Québec City’s building file does not cover Montréal. The city’s 3D model of 2020 (Bâtiments 3D 2020) measures roofs but leaves out Le Sud-Ouest, Griffintown’s borough, holding only three small structures by Rue Notre-Dame at the edge of the study area (certain). Its 2016 model of Le Sud-Ouest predates most towers here, and I have not used it yet.

The outlines

Only OpenStreetMap draws buildings; every other source is a list of points or rows. So S4 starts from its outlines, keeping each one whose centre falls inside the study area. When the centre of one outline lies inside a larger one, S4 treats the smaller as a part of the larger, as with Griffix on Rue Wellington, a 21-storey tower drawn over a 2-storey base.

The tax roll at its address

S4 matches each property’s street name and number to the city’s address points. Many rows found no match, because I downloaded the roll for whole streets across the island and the address points only around Griffintown. I once thought none of the missed rows stood in the study area; the lot outlines showed that 64 do, and they now count through their lot.

Every row finds its building

The city also publishes the roll with the outline of each property’s lot, the land it is taxed on, which every condo unit repeats. A lot is firmer ground than an address point, a single dot placed near a door or a curb, so S4 reads the lot first.

The buildings on a lot are those whose centre it holds or, failing that, any covering at least 30% of it. When the lot holds one building, the row goes there. When it holds several, the address point says which, and if the point stands in none of them, the nearest building within 15 m takes the row. When the lot holds no building, the address point works alone in the same way. Beyond 15 m a row stays unplaced, with the reason, since a longer reach risks the wrong building (stress tests).

Lot and point sometimes disagree. On a lot with one building, the lot decides. On a lot with several, where the point stands in a building off the lot, the point decides, since the lot cannot choose. Each such case becomes a checkpoint, ten so far.

Griffix is why the lot comes first. Its 197 flats, at 1045 rue Wellington, have their address point inside MaryRobert next door, where S4 used to count them, though their lot holds Griffix alone. Now they count in Griffix, and MaryRobert drops from 678 dwellings to 491.

The use

Each property’s land-use code begins with a digit naming a broad family, such as residential or commerce. A building takes the commonest family among its properties, leaving out condo parking spaces and storage units. A tie goes to the larger floor area, and a missing area is never read as zero. When the roll cannot decide, the OpenStreetMap tag speaks; a plain “building” tag names no use, so the use stays empty, with the reason. Every tie goes on my list to check, because it often means two buildings share one outline: at Ardent Mills, a 74-dwelling social housing property shares the flour mill’s.

Size

A building is as tall as its tallest known part. S4 takes the largest storey count from the roll or from OpenStreetMap, where every part inside the outline counts too, and notes its source. Condo units are left out, since the roll gives each only its own floor. I added the parts after an audit found MaryRobert at 2 storeys, its outline carrying only the podium; it now reads 22, from its tower. Where the dwellings cannot fit and no part helps, the building goes on my list to check. Its dwellings are the roll’s dwellings summed over its properties.

Ground floor and places

The premises are the 2025 survey’s spaces inside the building, vacant ones included. The places are anywhere a person might go: some from OpenStreetMap, the rest from the city’s public places and the survey’s occupied shops, leaving out benches and bike racks. A survey shop and an OpenStreetMap shop with exactly the same name in the same building become one place. A looser match, like Orangetheory Fitness against Orangetheory Theory, would be a guess, so S4 leaves it alone.

Assumptions

Assumption Why I accept it for now What would replace it
A building is used for what most of its properties are the roll is the most complete source floor area by use, if the roll gave it per unit
The nearest walkable street is the way in no open file has entrances entrances in OpenStreetMap, or a site survey
A property belongs to the building on its lot; on a lot with several, to the one its address point stands in the lot is the city’s own outline of the land where lot and point disagree, S4 asks
A building is as tall as its tallest known part OpenStreetMap draws towers as parts a height survey, or a licensed building file
A shop with the same name in the same building is one shop an exact match is a strong signal a site visit, or matching by address

Tests

The checks

Each check asks one plain question of the finished buildings.

Question Answer
Does every outline appear once, as a building or as part of one? Yes: 296 buildings, and one tower drawn over its podium
Does every value name its source, and every empty one its reason? Yes
Can every count be rebuilt from the source files? Yes
Is every property and shop in one building or listed as unplaced, never twice? Yes
Does each use follow its rule, ties included? Yes
Is every building linked to a walkable street within 80 m, or does it say why not? Yes. Six links exceed 30 m; Hangar 1825 has none
Is every place in or next to its building, with each shop listed twice pointing to its twin? Yes, with 52 such pairs
Is any building lower than its tallest known part? No. Nine take their storeys from a tower part
Does every property sit where its lot or address point puts it, with a checkpoint when the two disagree? Yes

One more check reports how much the sources cover; a gap there is a fact about the sources, never a failure. The Lab shows the latest results.

What the checks changed

The property check failed on its first run: 89 properties were counted twice, because the tax roll came in overlapping pages. S4 now keeps one row per property.

On the first map of uses, Ardent Mills, the flour mill, was painted residential. The roll puts a residential and an industrial property in its outline, and my first rule broke the tie by the order of a list, a choice I never made on purpose. Ties now follow the floor-area rule in the use.

The height check came from an audit: I set MaryRobert back to 2 storeys, and the check named it at once, since a part of it has 22. The same audit found an error in the arithmetic. Computed from map coordinates in the millions of metres, some outline centres lost their small digits and fell tens of metres off, enough to put four small outlines falsely inside their neighbours. S4 now measures each outline from its own first corner, and the false overlaps are gone.

TipTesting the tests

A test that always passes proves nothing. So I broke the finished buildings file four ways: I removed the reason from an unknown use, added one dwelling to a building, changed one use that came from the roll, and wrote 0 into an empty dwelling count. The checks caught all four. I did the same to the Lab’s copy of the results, which a further check compares with S4 down to every outline point: an unknown dwelling count turned to 0, one use changed, one point moved by 1 m, one place dropped. That check caught all four too.

Stress tests

Run twice on the same input, S4 gives the same output, line for line. The other stress tests ask how much the result depends on my choices.

The 15 m reach, within which a stray address point joins the nearest building, matters a lot at first and then very little. With no reach, 1,322 rows would be left out. At 15 m, 468 are, 415 of them at the one address point of checkpoint B01. At 30 m, two more find a building, and no property moves to another.

The last test shakes every address point by 2 m, then 5 m, as if the city had placed them a little off. At 2 m, 244 properties change building; at 5 m, 278. The total stays at 11,954 dwellings. An earlier run gave 625 at 5 m, partly because each point’s random move depended on the order the points were read in, so adding the lots reshuffled every move; each point now has its own fixed move. Without lots the test gives 291 at 5 m, so the lots barely change this number (certain): most properties sit on lots with several buildings, where the address point still decides.

That result is the warning. All the units at one address point move together, so where two buildings share a wall, a point a little off carries a whole condo tower into its neighbour. A single building’s count can be wrong while the block’s total is right. S5 and S7 should read dwellings by block, or with that in mind.