Section 40. A company whose petition for a location, necessary, in the judgment of the department, to furnish proper transportation facilities between two cities, or two towns, or a city and town, has in whole or in part been granted or refused, or has been neither granted nor refused within three months after the filing thereof, may, within thirty days of such grant or refusal of a location, or the expiration of said three months, apply to the department for such location. If it shall appear at a hearing on said application, after such notice to the board of aldermen or the selectmen, and to all persons who own real estate abutting upon any way in which such location was asked for, by publication or otherwise, as the department orders, that the company has already been granted and has accepted locations for a street railway in two cities, or two towns, or a city and town, adjoining the city or town where such location has been asked for, or has already been granted and has accepted locations for a street railway in two adjoining cities, or two adjoining towns, or an adjoining city and town, and that a location is necessary to connect such existing locations, the department may, if it finds that public necessity and convenience so require, enter a decree granting a connecting location. In granting the location the department may prescribe the appliances and impose the conditions and obligations which are specified or referred to in section seven relative to the granting of original locations. Such location shall be the true location, if, within thirty days after the issue of notice to the company of the entry of said decree, the directors shall file a written acceptance of such location with the department; otherwise, said location shall be void.