I have never run into any LEOs while caching, although I'm certain I've looked suspicious at one point or another.
Many cachers probably look suspicious to LEOs, even if they were "trying to not look suspicious". A good example of why a LEO might stop you is simpjkee. (nothing personal) A 25 year old male caching between 11pm and 3am.
Loitering, picking up/dropping off items, or parking in areas where people do not normally stop are all reasons for an LEO to suspect that you may be involved in a crime. The area that you stopped in may be prone to prostitution, vandalism or drug activity. Any officer who is doing his job should not assume that you are geocaching, even if there is a cache in the area. I think he should look into it.
The US Supreme Court ruled in Hiibel vs Sixth Judicial District that people must identify themselves to police.
How do you know that you are in the area legally?
Many parks and cemetaries have posted hours. Several towns in my area have local ordinances stating that it is illegal to be in those areas (if town/city owned and operated) after dusk. In that case the officer is doing his job and he is using his discretion to ask you to leave as opposed to just citing you for the violation. If you tell the LEO that you're caching, I don't think there would be much of a problem (aside from being asked to leave).