A city of the first class by ordinance may regulate levees, depots, depot grounds, and places for storing freight and goods, and provide for and regulate the passage of railways through the streets and public grounds of the city, reserving the rights of all persons injured thereby.