(a) The city council of any city of the first or second class and the town council of any incorporated town shall have power to grant to any railroad company a right-of-way through the streets of the city or town, with the right to establish and maintain depots and other necessary improvements in connection therewith.
(b) If any property is damaged, the railroad company shall be liable for the damage, which shall be assessed in the manner provided by law for assessing damages for the appropriation of the right-of-way through lands.