Defense from natural risks and ecological transition of the built environment