The city of Hamilton has been ranked number 239 in an international housing affordability survey. 

Demographia, a U.S.-based consultancy that focuses on urban planning issues, compiled a list comparing real estate affordability in 337 world cities. The list was based on what Demographia calls the "median multiple" — the amount by which house prices are higher than average salaries.

"In affordable and normal housing markets, house prices do not exceed three times annual household incomes," the report reads. "If they do exceed this standard, it indicates that there are political and regulatory impediments to the supply of new housing that need to be dealt with."

Hamilton tied for 239th place with the city of Swansea in Wales. The survey determined the median house price in Hamilton to be $315,400 and the median household income to be $69,300.

While Canada as a whole ranked as one of the most affordable markets in the world when it came to housing, along with the United States and Ireland, the city of Vancouver didn't fare as well. It ranked as the second most unaffordable housing market in the survey, beaten only by Hong Kong which was ranked the most unaffordable housing market in the world. 

All in all, Canada had eight affordable markets, 17 moderately unaffordable markets, four seriously unaffordable markets and six severely unaffordable markets. Those six are Toronto, Vancouver, Victoria, Montreal, Abbotsford, B.C., and Kelowna, B.C.

Canada's most affordable cities were Fredericton (N.B.), Moncton (N.B.), Saint John (N.B.), Windsor (Ont.), Thunder Bay (Ont.), Charlottetown (PEI), Saguenay (Que.) and Trois-Rivieres (Que.).

With files from CBC News