edb3_16 via Getty Images An aerial view of downtown Calgary. The city ranks has the most affordable housing market of any major metro area in the U.S. or Canada, according to Zoocasa.

Affordable housing might be the one reason Canadians still envy their southern neighbours these days (a four-bedroom villa in Houston for $300,000, anyone?), but it turns out there may be nothing to envy there, either. According to a new survey from real estate site Zoocasa, Calgary is the most affordable major housing market in the U.S. or Canada. The survey looked at the 30 largest metro areas in the U.S., and the five largest in Canada. It compared the median household income against the income you would need to buy a median-priced house. Watch: The extreme measures Canadians go through to buy a home. Story continues below.

And as it turns out, residents of Calgary have the largest income "surplus" of any of those cities. A household with a median income in Calgary earns US$30,298 more than it needs to in order to afford a median home. (All the figures in the study were in U.S. dollars.) Calgary's house prices don't look particularly low when compared to other mid-sized Canadian cities, but the city has a very high median income, thanks to high-paying jobs mainly related to the oil industry. Residents of Montreal and Ottawa also enjoy a "surplus" of US$4,161 and US$16,326, respectively. Meanwhile, in Vancouver, a median household earns US$74,285 less than it would need to afford a median house.

Zoocasa/HuffPost Canada

Zoocasa