We moved into a house that previously housed 4 cats. Even though they were gone, neighbor cats still visited our flower gardens. We did OK with moth balls - supposedly the cats don't like the smell:
1) Use old containers with good fitting lids (sour cream, yogurt, etc).
2) Cut some holes (3-4 or 5) in the sides of the containers - any shape, but smaller than the moth balls.
3) Put in a handful of mothballs and cover. Place in garden every 6 feet or so (experiment with this, we just used 2 containers to cover a 14 ft strip)
4) Since most containers have sloped sides so the container gets smaller at the bottom, there shouldn't be a problem with rain getting in, but sprinklers might.
The smell wasn't so strong as to repel us from the garden, but the cats didn't seem to like it.
USE with Care with little ones around!!!!
It worked for us -- just replenish the mothballs occasionally. Once the cats stop using the area for a while, they're no longer lured to use it.