Sorry you got hassled. It's only a $25 ticket so taking time to challenge it might not be productive, but still consider challenging it to hopefully maintain access to good photography locations.
You said it was a forest preserve. Who owns it: federal, state, county, non-profit, etc.? Which jurisdiction wrote the ticket? Was it even the police - some parks are patrolled by public safety departments (not technically "police" where I live but they can still issue tickets) or maybe private security? Were you parked in a parking lot or along a roadway? (No need to reply with answers, just things to think about if you fight the ticket)
In order to have better luck in the future, think about
:
- Join a local astronomy club. They will know good astrophotgraphy sites and how to get access.
- Contact the park owner to see if there's some way to get written permission for nighttime access.
- Call your State or local parks dept. to ask if any parks allow photos at night. Mention that you're a hobbyist rather than a professional (pros often face tougher restrictions and higher fees).
- If the parks dept. is unhelpful, call politicians who oversee the parks dept. Explain how the all-parks-closed-at-night policy impacts you. Ask for suggestions and assistance.
- Call the police dept. non-emergency number, or speak to an officer on the street. Don't mention your prior ticket. Let them know you want to take nighttime photos. Do they know any places where you can do so safely and legally?
Almost all parks near me (Long Island, NY) are closed at night. The State Park Dept. issues a $30 stargazing permit that allows access to specific parking lots. Money well-spent.