When I was living in a city in a really nice neighborhood, my neighbor and I took very good care of our lawns, and put a lot of time, effort and energy into them. We both had dogs and if other people's dogs did their business on our lawns, it would drive our dogs up the wall to no end. Not to mention, if the dogs pee on 1 plant long enough, it will kill the plant.
So I got a bright idea one fine day. I still had my solar powered electric fence, got some of that new nylon tape that has stainless steel wire woven into it, got it in the same color as the grass, and laid it down and pinned it with golf ball spikes where the strange dogs like to do their business and fired it up.
Next thing you know, the dog walkers (or strays) would come up, then ZAP!! Dog goes running and yelping but otherwise unhurt. Left it like that for week, then moved it to my neighbor's yard. NONE of the dog walker's dogs dared to do their business on our lawns for fear of getting the wieners zapped!!
Don't worry. It doesn't cause burns or damage the mutts. But it sure is funny and did solve a problem.