The Southern Pacific from San Francisco cut diagonally across the Mission from the 3rd and Townsend area, turned south at Dolores, climbed around Bernal Heights then ran along what is now San Jose Ave., the BART line and the 280. Below is the photo of the 3rd and Townsend station.
The Valencia Station at 25th and Valencia (SW corner) was perhaps the most popular stop in the city for the living and the dead. The railroad was the only transportation option for many families to the cemetary and gravesite in Colma. After San Francisco passed ordinances on burying the dead within city limits, the city began evicting all the corpses from earlier cemetaries built around the city. Valencia Street became the area where undertakers and mortuary and funeral businesses were established. The railroad ceased carrying passengers in the 1920's but continued to haul out the dead from Valencia Station until the early 1940's!
These photos show the train making its way around what was called the Bernal Cut (Bernal Heights, San Jose Ave, Mission St, Monterrey Ave area.)