Raccoons are a protected species in Ontario. For that reason, you cannot do anything at all that may harm them. No spikes, nothing sharp, you cannot hurt them so keeping them out of your garbage is a lot more about keeping your garbage away from them. Food in general is something humans take for granted. Since we started having more stuff than we can carry we have never been without. Seventy thousand years of plenty with only small moments of draught is something wild animals do not and cannot know or understand. For them, food is hunting. They are still wandering the land with a spear looking for food in the natural world. They do not have farms or grocery stores or restaurants or food trucks. They do not have a pantry stocked with food. Every meal is a battle every morsel of food a fight. This is not to say you should actively feed them, that will only make their roaming on your property worse. If they have issues with raccoons on the property then your most important job is not to get them off the property but to stop them from getting in. Wildlife wanders and they cannot tell what is your property and what is the wild. They go from parks to ravines to homes and back without thinking they have crossed any sort of boundary.
The only real way to keep animals off your property is to remove any sources of food and water. Pools, leaky hoses and birdbaths will draw animals to your property who are thirsty. Bird feeders and barbecues are accessible to animals and are often not properly cleaned. This is lunch for a raccoon, whatever tiny pieces of meat are left on the grill will be its dinner. You must bring everything you use to cook outside inside when you are not using. Get rid of any water on your property. If you have a pond, fill it with concrete. don’t give them the chance to find food and water or they will learn from that and keep coming back. So take precautions to put your barbeque in the garage when you’re not using it, and store your garbage in locked and sealed containers so there is no smell. Take every precaution you can. If there is a fruit tree that is attracting animals cut it down. If you do all of this every animal you see coming to your property will wander and search for a few hours and then leave, finding nothing. This is how you keep animals off your property.