Missouri’s big cities don’t compare well to other spots across the country as places to live, according to a recent survey.

Personal finance website WalletHub compared the 62 largest U.S. cities based on 56 indicators, ranging from the quality of public schools and life expectancy to job opportunities and property taxes.  Kansas City placed in the lower half at number 40 while St. Louis was near rock bottom at number 58.

The municipalities were ranked across five categories – Affordability, Economy, Education and Health, Quality of Life and Safety – that were each given equal importance to determine the final outcome.  A total of 56 factors figured into the five categories.

The brightest spot for Kansas City in the survey was Affordability, where it’s in a highly competitive position at number 13.   Five factors – Cost of Living, Housing Affordability, Median Annual Property Taxes, Median Annual Household Income, and Homeownership Rate – determined where cities ranked for Affordability.  Cost of Living was given three times the weight of the other four factors.  St. Louis ranked 32nd in Affordability.

The Gateway City received its highest marks in the WalletHub survey for its Quality of Life, where it placed 21st.  Almost half of the factors, 24, were used to figure where cities ranked in the Quality of Life category.  They ranged from Average Commute Times to Restaurants, Movie Theaters, Music Venue and shopping Centers per Capita to Weather and Air Quality.

Kansas City placed down the line at 43rd for Quality of Life.  One factor that pulled its ranking down was “bike score” where Kansas City placed lower than all but four other cities.

Both cities, which are known for violent crime, fared worst in Safety: Kansas was number 55 while St. Louis was almost dead last at number 61.  The factors determining Safety were Violent-Crime Rate, Property-Crime Rate, Traffic Fatalities per Capita and Total Law-Enforcement Employees per Capita.  St. Louis had the highest crime rate of all 62 cities, which contributed to its low ranking for safety.

The widest gulf between the Missouri cities was in the category of Education and Health, where Kansas City was in the top half at number 30 while only Detroit was lower than St. Louis ranking at number 61.  Eleven wide-ranging factors determined Education and Health.  Among them were Quality of Public School System, Share of Population Aged 25 & Older with a High School Diploma or Higher, Premature-Death Rate and Share of Physically Inactive Adults.

The two biggest Show-Me State cities were in the lower third of municipalities in the category of Economy.  Kansas City was 46th while St. Louis came in at number 53.  The 12 factors that determined the cities’ Economic standing ranged from Unemployment Rate to Population Growth to Wealth Gap to Food Insecurity.

Overall, the top 5 cities to live in according to the WalletHub survey were Seattle followed by Virginia Beach, Virginia, Austin, San Francisco and San Diego.  The only cities ranking lower than St. Louis at number 58 were Baltimore, Cleveland, Memphis and Detroit at the bottom.

The WalletHub survey notes that although “urban settings” occupy less than 3 percent of the U.S. landmass, they contain close to 80 percent of the total U.S. population.  The difference in Missouri is not quite as pronounced.  A little less than 70 percent of the population of the state lives in less than 3 percent of the land.

The Kansas City and St. Louis urban areas are unique in that both have a portion of their populations in different states.