Stopping vagrants from sleeping on sidewalks and streets isn’t a punishment. They are not prisoners, they’re a public nuisance.
So how do you legally prevent people from being in a public place?
How do you prevent them from eventually falling asleep?