Sorry to hear about your run-in with the cops. I would not be to worry about it, but I would be more concern about it instead. Unless they are going to write you up with notice for not being there or summons, arrest you, hold you for major questioning, etc. I know with recent terrorist situations that happen recently in NYC and cert part of country does not help with cops being on edge. Who can blame them for acting more concern with what going on now in the Americaand in the world.
This what I would do if I know I am planning to watch, photography, video of trains or railroad operations hear some rules I follow. 1) Safety, Safety, Safety is a must. 2) Make sure to wear something that will not attract to much attention to yourself for examples types of clothes, hats, colors that make you stick out, etc. 3) Make sure you keep your equipment low key as well for example like camera/video equipment, scanner, tripod, too much equipment with you, etc. 4) Don't hang around the same location to long if you can. 5) Be careful where you plan to stop to watch trains that could be too sensitive areas near rail yards, signaling towers, major switches, structures, towers, etc. 6) Watch where you are parking your vehicle near the location you are hanging at for examples; no parking zones, private parking lots, private streets, train stations so forth. 7) Make sure to handle yourself a certain way not draw attention to you. How your standing, walking, talking with friends, people walking in area, etc. 8) Also bring something that will identify that like trains, railroads, but nothing to flashy from rule 1. Usually I wear train hat or shirt. I have more than that but I could go on and on. If you follow what I wrote on here you should not have any problems with the police or law enforcement for that matter.
Here are my two cents.
I think the only time I had something happen to me once were policeman from Westfield was busting my chops for watching trains in another town of Scotch Plains and telling me could not watch trains any more few years ago which the Scotch Plains knew you were hanging there for years with no major problems, but all other run-ins with cops were ask me what I was doing near the tracks or why do you have radio (aka scanner) for, etc and nothing more.