Not 100% certain how legal, but I crossed this railroad bridge...
Normally 0% illegal, but since the bridge tender (it appears to be a drawbridge) allowed it you were an invitee. Working in the rail industry, I feel compelled to warn people not to do what you did. A month or so ago in FL a couple of teens were hit by a train and killed while crossing a bridge. One was fast enough to make it and watched as his slower companions were struck.