2017 was a wild ride on many fronts in the U.S. Between natural disasters, political upheaval and the ongoing influence of, and discourse about, social media there were days when it seemed the very landscape of the country was wobbling under our feet.

But, in the midst of this, the economy did well — as evidenced by the 25-percent growth of the Dow Jones industrial average.

Likewise, the Core Four Tier-1 gateway cities in the U.S. continued to offer excellent opportunities for real estate investment. In fact, AT Kearney’s annual analysis of the world’s most influential cities puts New York in the No. 1 spot. San Francisco is ranked first for outlook because, according to the report, it’s “best positioned to attract and retain global capital, people, and ideas in the coming years.”

Boston and Los Angeles are also in the top 25 cities when ranked for outlook.

The full analysis is based on the concept that “cities are ecosystems for business and innovation.”

The report takes into consideration multiple factors including the strength of the urban center’s network of businesses, the talent of its citizenry, the stability of political institutions, and the creativity of cultural organizations. These are all things that “contribute to an environment in which existing businesses flourish and new businesses are born.”

This dovetails nicely with assessing cities for real estate investment. Gateway markets, unlike secondary markets, are places where investors commit. The opportunities exist because of, not despite, the barriers to entry.

Think about it: it’s nearly impossible to build in New York and San Francisco. There aren’t blocks of empty lots or wide open spaces. So the trick is to find something that’s underperforming and leap on that opportunity.

For instance, buildings that are owned by a landlord who hasn’t invested in tenants’ needs due to lack of funds. Or, a property that’s been in the family for multiple generations and is now co-owned by multiple stakeholders (who want out).

These properties do exist, and their potential is enormous because the net operating income (NOI) from renters is essentially locked in (the housing markets being exceptionally tight) and the value of the property will only increase due to the challenge of finding properties in the first place.

Los Angeles is as good an option as San Francisco and New York, because of its high demographic of younger people (nearly 25 percent of the city’s population was between the ages of 20 and 34 in 2015 ) and correspondingly large rental market (60 percent of housing stock was renter-occupied in 2015).

Then there’s Boston, which is the nexus of all the factors that signal good investment opportunity. It’s a relatively small, but established, city that had limited property available and strong demand for rental units. The economy of Massachusetts has had steady growth over the past few years.

Finally, there’s this: according to an article in The Atlantic, the U.S. is home to six cities with the highest level of venture capital in the world. New York, San Francisco, Los Angeles and Boston are all on that list.

If that much is being invested in the people, businesses and ideas that create a city, then investing in the buildings that are home to those things is as close to a sure bet as exists in today’s ever-changing world.