Section 141. The board of aldermen of a city or the selectmen of a town where a traveled place is crossed by a railroad at the same level, if of opinion that it is necessary for the better security of the public that boards such as are described in the preceding section should be maintained at such traveled place, may in writing request the railroad corporation to erect and maintain them. If it refuses or neglects so to do, they may apply to the department. If the department, after public notice and a hearing, decides that such erection is necessary for the better security of the public, the corporation shall comply with such decision.