The mayor and council shall by ordinance require, under proper penalties, any railroad company, whether steam or electric, to elevate or lower any of its tracks running over, along or across any of the streets, avenues or alleys of the city, whenever in the opinion of the mayor and council the public safety or convenience requires.