Every municipality shall have power to extend any street, alley, or highway over, under, or across, or to construct any sewer, water pipe, or main under or through any railroad track, right-of-way, or land of any railroad company within the corporate limits, but where no compensation is paid therefor, the municipality shall restore such track, right-of-way, or land to its former state as nearly as may be and so as not to impair its usefulness.
SDCL 9-35-7