Section 28. Any company subject to this chapter, except a telegraph or telephone company, desiring to construct a line for the transmission of electricity which will of necessity pass through one or more cities or towns to connect the proposed termini of such line, whose petition for the location necessary for such line has been refused, or has not been granted within three months after the filing thereof by the board of aldermen of a city or the selectmen of a town through which said company intends to construct such line for the purpose aforesaid, may apply to said department for such location. The department shall give a public hearing thereon after notice to the board of aldermen or selectmen refusing or neglecting to grant such location, and to all persons owning real estate abutting upon any way in the city or town where such location is sought, as such ownership is determined by the last assessment for taxation. The department shall, if requested by the board of aldermen or selectmen, hold said hearing in the city or town where the location is sought. If it appears at the hearing that the company has already been granted and has accepted a location for such line in two cities, or in two towns, or in a city and town adjoining the city or town because of the refusal or neglect of whose board of aldermen or selectmen to grant a location therefor the application is made, or if it appears at the hearing that the company has already been granted and has accepted locations for such line in a majority of the cities, or towns, or cities and towns through which such line will pass, and if the department deems the location necessary for public convenience, and in the public interest, it may by order grant a location for such line in the city or town with respect to which the application is made, and shall have and exercise relative thereto the same powers and authority conferred by section twenty-two upon the board of aldermen or selectmen and in addition to the provisions of law governing such company may impose such other terms, limitations and restrictions as it deems public interest may require. The department shall cause an attested copy of its order, with the certificate of its clerk, endorsed thereon, that the order was adopted after due notice and a public hearing as hereinbefore prescribed, to be forwarded to the city or town clerk, who shall record the same and furnish attested copies thereof. The company in whose favor the order is made shall pay for such record and attested copies the fees provided by clauses thirty-one and thirty-two, respectively, of section thirty-four of chapter two hundred and sixty-two.