. . "If it shall be necessary, in the location of any part of any railroad, to occupy any road, street, alley, or public way or ground of any kind, or any part thereof, it shall be competent for the municipal or other corporation or public officer or public authorities owning or having charge thereof, and the railroad company, to agree upon the manner, and upon the terms and conditions upon which the s" . . . .