Making photographs while on train tracks and in train yards is very dangerous and there is much cause to stay off railroad property, and their tracks:
• It's illegal to be on or very near to railroad tracks for photography without the permission of the railroad which owns and/or uses the tracks. (Many railroads share tracks with other railroads. You need at least the permission of the tracks' owner.)