A historic Los Angeles hospital that has been a popular location for filming movies and television shows will soon become affordable housing for low-income seniors.

Two decades after shutting its doors, the old Linda Vista Community Hospital is about to get a $40 million transformation and a new purpose.

“The building has been sitting vacant in the middle of the Boyle Heights neighborhood, where there is an enormous need for affordable housing,” said Percival Vaz, CEO of AMCAL Multi-Housing, the affordable housing developer tackling the project.

Work is expected to start in about two weeks to convert the former nurses’ residence into 23 seniors apartments. A second phase calls for transforming the main hospital building into 74 apartments.

Originally known as Santa Fe Railroad Hospital and Santa Fe Coast Lines Hospital, the facility opened in 1905 for employees of the Atchison, Topeka & Santa Fe Railway in a working-class part of town that was home to many railroad workers.

The building was razed and rebuilt around 1924 and later renamed Linda Vista Community Hospital. Although it has been closed since 1991, the mission revival-style complex has been a popular filming location.

It has been used in numerous movies, including “Pearl Harbor,” “Outbreak,” and “Se7en.”  Television shows, including “Buffy the Vampire Slayer,” the pilot episode of “ER,” and, more recently, “True Blood” have also filmed on site.

Some props, including a wooden throne from the upcoming Rob Zombie movie “The Lords of Salem,” remain in the building, said Vaz.

Over the years, the hospital has also gained a reputation for being haunted.  The caretaker claims to have felt a child putting a hand in his when no one was around, and the Travel Channel’s “Ghost Adventures,” a show that visits spooky places in search of paranormal activity, has visited the hospital.

Vaz said he has not encountered any ghosts, but then he hasn’t spent too much time walking through the relic.

Over the years, other companies have looked at renovating the building, but their plans have never panned out. That’s not the fault of any ghosts but rather financial challenges. One developer was going to turn the hospital into condominiums, but then the condo market crashed, said Vaz.

AMCAL, an experienced affordable housing firm based in Agoura Hills, Calif., has been able to move forward with a $9 million commitment in federal Neighborhood Stabilization Program (NSP) funds from the Los Angeles Housing Department.

The program was created to help communities recover from foreclosed and abandoned properties. “This is a perfect use for NSP,” Vaz said.

The first phase, the renovation of the nurses’ residences, is also being financed with 4 percent low-income housing tax credits (LIHTCs) and tax-exempt bonds from California, with equity from Union Bank and a loan from JPMorgan Chase, according to AMCAL.

The second phase will likely involve the renovation of the upper floors of the hospital, with the developers seeking 9 percent LIHTCs to help finance the effort.

That leaves the ground floor, which could become more housing or used for another purpose, said Vaz.

AMCAL has been a leading developer of affordable housing across the state, with much of its work being new construction projects. The firm’s second rehab project, Linda Vista signals a growing area of interest for the company.

Vaz said he has been exploring more acquisition-rehabilitation deals as a way to grow the company and because these projects often require fewer soft financing sources, which are becoming increasingly scarce.

In addition, he said, these developments will also help meet California’s large need for affordable housing.