A man and his German shepherd had to be rescued from a tree after flash flood swamped a park in Barrie, Ont.

Police said the man, 35, was camping with a 21-year-old woman and a dog in Barrie's Sunnidale Park on Sunday evening when the park flooded.

The trio was walking across Canada as part of a pet homelessness campaign, and decided to camp out in the park located near Highway 400 and Bayfield Street.

They set up their tent and went to sleep, not knowing they'd chosen a location in a water retention area, which collects overflow from nearby city streets.

The area quickly filled with water, washing away the tent, a bicycle and other belongings they had with them. Police said the woman swam out of the water and was able to flag down a vehicle on Highway 400 and call for help.

The man and the dog sought shelter in a nearby tree.

When Barrie firefighters arrived, they found the man and the dog in the tree, surrounded by a puddle that was nearly two metres deep and full of debris.

Firefighters used a raft to rescue the man and dog, and both people were transported to hospital to be treated for hypothermia.

The dog was taken to a nearby shelter for care, and will be picked up when its owners are able to leave the hospital.