Databases as file formats

The .mbtiles way

I’m building an interactive online map of all properties in Vancouver, and along the way there have been a few pleasant surprises. Most recently: the .MBTiles tileset format is surprisingly cool.

Background

Mapbox is one of the biggest players in the open source mapping space (especially now that Mapzen and Carto have thrown in the towel – Mapzen is closing and Carto is now using Mapbox tech). One of the many nice things about Mapbox is that they developed an efficient open standard for vector map tiles, appropriately named Mapbox Vector Tiles (read this if you’re not sure why vector tiles are great).

Map tiles are often pre-computed for each zoom level, and once you’ve done that you need to store them somewhere. Enter the .MBTiles tileset format.

Poking around under the hood

My first encounter with this file format occurred when I used Eric Fischer’s excellent tippecanoe tool to simplify my data set at lower zoom levels. Tippecanoe generates .mbtiles files, which are easy to serve to clients either by uploading to Mapbox, using a third party tile server, or even by rolling your own server with something like the mbtiles Node.js package.

All great… but after setting up a server my Mapbox GL JS client refused to render the tiles. I tried a few things without much luck, and then as a last resort I decided to poke around in the .mbtiles file. I was expecting to need a hex editor or similar, but then I saw this beauty in the spec:

MBTiles is a specification for storing tiled map data in SQLite databases

The files themselves are just relational databases in a known schema – how cool is that? Emboldened, I grabbed a SQLite client and opened up my .mbtiles file:

Hi there - I’m Reilly Wood, a software developer from Vancouver, Canada. This site is still under development, but I’m planning to fill it up with thoughts and impressions about software, cities, finance, and whatever strikes my fancy. Stay tuned (perhaps with the handy RSS feed).

Vancouver’s rocky start with secondary suites

From wartime homes to student homes

Or: that time that Vancouver decided single-family zoning was more important than defeating Hitler

Secondary suites (often just “basement suites”, or ADUs) are an everyday part of Vancouver neighbourhoods now. Even before they were fully legalized in 2004, they provided a large amount of Vancouver’s low-cost housing stock.

The story I usually hear about suites goes like this: people started building a lot of unauthorized suites in Vancouver Specials in the 1970s and 1980s, and this set the stage for a long drawn-out political battle that eventually ended with suites being legalized.

It’s a good story, and it’s true! But Vancouver’s history with secondary suites goes back much further. People were trying to live in secondary suites – and Vancouver was trying to stop them – for a long time before the Vancouver Special.

Ask a random person what the purpose of zoning is, and they’ll probably mention that it keeps unpleasant or dangerous things away from homes. You wouldn’t want to live next to a garbage dump or concrete factory, right?

Most people agree that that’s a good thing, but zoning codes do a lot more than that. If you could ask the people who wrote our first zoning codes, you’d quickly learn that separating industry from homes was very far down their list of goals. Separating certain homes – specifically apartment homes – from other homes was the primary motivation for Vancouver’s first zoning code.

Point Grey

Our story starts in the 1920s, with 3 municipalities where Vancouver lies today: The City of Vancouver, Point Grey, and South Vancouver. Point Grey encompassed not just modern-day Point Grey, but most of the West Side. Point Grey was the first municipality in Canada to introduce zoning in 1922. The chairman of the Point Grey Town Planning Commission was eager to boast of the zoning bylaw’s “successes,” specifically, how it excluded lower-cost housing:

Such by-laws as these served, in no uncertain way, to implement the ideals held by the residents that their municipality was to be one in which the best type of home could not only be built, but also adequately safeguarded from the encroachments of undesirable types of development. That the quality and type of dwelling within the municipality at the present time is of a very high order is indicated by the study of the “dwelling permits” over a five-year period. The average cost of residences over such a period, these “permits” show, was in excess of $4,100. At the present time over ninety per cent, of the municipality is zoned for one-family dwelling districts. Point Grey has no slum district. (A Plan for the City of Vancouver, p. 297)

Vancouver’s Interim Zoning Bylaw

By 1927, the City of Vancouver was seriously considering a zoning bylaw of their own. They had hired Harland Bartholomew, a prominent urban planning consultant, to devise a comprehensive plan for Vancouver. But these things take time, and time was in short supply. Well before Bartholomew could finish his official plan, Vancouver commissioned him to write a temporary bylaw to stop the most pressing danger to the city: apartment buildings. His instructions were unambiguous:

“When Bartholomew asked what abuses he should consider in the interim zoning by-law of 1927 he was preparing, the chairman replied that ’the only serious abuse… is the intrusion of undesirable apartment houses into residential districts’” (Zoning and the Single-Family Landscape, p. 60)

Bartholomew was happy to state the motivation for the interim bylaw in official documents:

…largely to prevent the intrusion of apartment houses in single or two-family residential areas, an interim zoning by-law was prepared and approved by the Town Planning Commission, recommended to the Council, and became law on 5th February, 1927. (A Plan for the City of Vancouver, p. 211)

headshot

Cities & Code

Top Categories

View all categories