Just out of curiosity, do you ever get crap from the RR companies for flying a drone that close to their equipment? (Especially military cargo?)
Oh boy, this topic is one of the grayest gray areas concerning drone operations, surveillance, and photography.
While that's not my video, I do enjoy railfanning with my drone. Luckily, I've not been approached while flying, but I have been approached pre-drones when just shooting with a DSLR and just that is a coin toss, especially post 9/11.
No matter what, be informed and know your rights. After that, be polite, gauge the situation, and if anything feels uncomfortable, calmly just leave.
1. If you're on public ground (or private ground with permission (better have written proof)), you may photograph
whatever is in sight, so long as you're not putting yourself or others in danger while doing so. So Freight Yards, Airports, Military Bases, Police Stations/Operations, "Infrastructure"; anything.
2. FAA grants
no ownership to any airspace below 400 feet, except within 5 miles of any airport, federal parks, and certain other properties and populations. So long as you're following all other regulations (maintaining line of sight, avoid people and crowds, not being reckless*, ect), there's quite a bit of freedom allowed for drone operation, including over private property and railroads.
*You might think flying just a few feet from a million dollar tank could be considered reckless, but how do you prove it is reckless? Unless contact is made, where measurable damage can be claimed, this is a huge gray area.
3. Law enforcement and public safety officers may give zero Fs about your 'legal right' to photograph or fly. Handle any approach or encounter with caution. You may be 100% in the right, but they have the situational authority. That's a pissing match, they'll win every single time.
From 2004 thorugh 2012 I've had 6 encounters while either railfanning or doing astrophotograhy. 4 of them were 5 minute stops, including state patrol, local police, and one railroad police. They pulled up, asked if I needed any assistance, made sure I was aware of hazards, asked me to keep safe, and went on their way.
The other two were both county sheriff and were both nightmares. In one case, it was clear they made up their mind ahead of time that I was some sort of bad guy. Sure, it was the middle of the night, but you find a guy out in the literal middle of nowhere, with a laptop and a telescope (yes pointing up

), how is the default thought process that this guy is hostile? *sigh*

Bottom line, if authorities want you to leave, you might just have to leave. If they seem level headed, you can try to plead your case, maybe they'll re-consider and let you be. Just don't try to argue, you may end up leaving in their car instead.