Cities have a way to go before they can be considered geniuses. But they’re getting smart pretty fast.

In just the past few years, mayors and other officials in cities across the country have begun to draw on the reams of data at their disposal—about income, burglaries, traffic, fires, illnesses, parking citations and more—to tackle many of the problems of urban life. Whether it’s making it easier for residents to find parking places, or guiding health inspectors to high-risk restaurants or giving smoke alarms to the households...