In many states/cities, street vendors must prominently display their license on their cart, which also keeps them from being anonymous. In many states, taxi drivers must prominently display their license, which has their name on it for any occupant to see, etc. etc.
I'd need more info on what state you were in and a cite to the law you are referring , but in brief, when a person is engaged in certain licensed activities the state can require them to display and/or carry certain documents. Many states require LEO's to carry their commission card when on duty, for example.