Not sure how this is in other places, but in my country train and road have specific corridors for hazardous materials. These avoid things like tunnels and densely populated area's.

In many cases the type of materials transported in large quantities are known and can thus be prepared for.

Do note that there outflow of any goods are limited by the amount present. That gasses will get in to building; thus ventilating after a cloud of gass has passed is important.
_________________________