Map: The salary you need to buy a home in 27 U.S. cities

Here’s definitive proof that San Francisco’s real estate market is insane. HSH.com, a mortgage research site, has estimated how much salary you need to earn to afford the principal, interest, taxes and insurance payments on a median-priced home in 27 metro areas.

On a national scale, a buyer who puts 20 percent down would need to earn a salary of $48,604 to afford the median-priced home in America. But that total varies a lot from city to city. Pittsburgh, Cleveland, St. Louis and Cincinnati rank as the most affordable metros in which to buy a new home – HSH.com estimates that you can buy the median home while making less than $34,000 – while New York, Los Angeles and San Diego are at the high end, requiring salaries of nearly $90,000 or more. But the most expensive city by far is San Francisco, where the site estimates you would need to make $142,448 to buy the median home in the area.

The site's calculations assume that a buyer spends 28 percent of gross monthly income on housing, including principal, interest, taxes and insurance, (in line with industry guidelines for standard "front-end" debt ratios) and makes a 20 percent down payment on a house. To calculate the cost of buying the median-priced house in a given urban area, HSH.com combines its own average interest rate for 30-year, fixed-rate mortgages in the fourth quarter; the National Association of Realtors’ data on median-home prices in the fourth quarter; average metropolitan property tax data from the Tax Foundation, a Washington-based think tank; and statewide average homeowner insurance premium costs from the Insurance Information Institute, an industry organization.

The data is, of course, an estimate — for one, property taxes and insurance costs will vary depending on the property — but it gives you a good idea of how housing costs varied around the country in the fourth quarter. You can read more about the methodology and see the site's data here.