For myself, I take the situation into account no matter where I am, with a bit more caution away from home. I frequently trespass on the yard property at my largest local yard BUT…it is very common for railfans to do so, and it is safer than staying beside the road. (Might get hit in the head by a small stone whipped up by a passing pickup [;)] )
Anyways, this is what I do.
Don’t cross fences.
Stay away from the tracks.
Stay out of congested areas.
Make sure that the ‘no trespassing’ signs are small an infrequent [;)]
Stay away from what look like they could be sensitive areas
Oh, and make conversation with the friendly-looking employees!
I’m fairly sure that the railroad employees would agree with these points.
At my local yard, there is a road about 80’ away from the tracks. In between, there are a series of railway parking lots as well as a fueling station. It’s like the railfanning mecca of anyone in Calgary. Great views from the two parking lots, as well as being able to stand on an access road quite close to the main shops. (Heck, I once got invited in for a short tour of them while standing there!) http://www.railpictures.net/viewphoto.php?id=160920
http://i21.photobucket.com/albums/b274/trainboysd40/alythlineupwabw.jpg
Over at the parking lots the view looks like this: http://i21.photobucket.com/albums/b274/trainboysd40/5590atcrewchangeofficelowquality.jpg
You’re seperated from the tracks by a yellow-painted rail, and I have NEVER crossed it.
So, it all depends on the situation. If you can find nice spots like that (There are no fences in that area, mind you) and you haven’t heard horror stories about the local RR police torturing railfans, I’d say (cautiosly) go right ahead! (But BE CAREFUL…)