Security preparations for Barack Obama's visit to Ottawa have been months in the making as the RCMP, provincial and municipal police readied themselves for the U.S. president's visit to Canada, an RCMP spokesman says.

The planning for a presidential visit involves both the secret service and the RCMP, who lead the process to assess the summit's location for security threats, and co-ordinate road closures to protect the area around it.

"The RCMP has done [the] G8, G20, the Olympics, and we have an expertise in organizing these big events," said Sgt. Harold Pfleiderer, a spokesman for the Mounties. "They're highly professional, highly trained, and they're trained for these kind of events."

Obama's official car, an armoured vehicle known as the Beast, arrived by plane in Ottawa on Tuesday and will be part of the motorcade that carries him around the city. Locals may have noticed police motorcycles and black SUVs driving in convoys through downtown streets the past few days, or helicopters flying overhead.

"They're practicing. It's all about practice and then when it comes the day of, you're hoping that everything flows appropriately, the way it's planned," Pfleiderer said.

P.Y. Borduas, a former deputy commissioner of the RCMP, says the Mounties try to meet the secret service's criteria when it comes to the president's security.

"Everything is done in full integrated mode, but ultimately the accountability rests with the RCMP," he said.

Even with that preparation, a number of downtown streets will be closed to traffic -- and nobody in the area will move if Obama's motorcade is in transit. But sometimes the VIP can disrupt the RCMP's best-laid plans.

Both Borduas and Pfleiderer pointed to Obama's first trip to Ottawa in 2009, when he made an unscheduled trip to the Byward Market to buy a cookie. Pfleiderer says it's important to make sure the VIP under RCMP protection doesn't feel like he or she has panicked the security detail.

"You have to make it look as seamless as possible so it doesn't make the visiting dignitary feel uncomfortable," he said.

Preparing for the visit of a high-profile leader isn't just about logistics, however. It can also involve watching social networks to ensure the RCMP are on top of any potential threat.

"They're scanning internet, they're scanning Twitter, and social media just to make sure that they're able to catch maybe someone that is indicating an intention to cause harm to any of these VIPs," Borduas said.

Obama's last trip to Ottawa was prior to the Oct. 22, 2014 shooting on Parliament Hill and prior to high-profile terror attacks in Paris and Brussels. Borduas says those kinds of attacks changes the calculus for law enforcement agencies.

"Canadian authorities have looked at what happened in Paris, what happened in Brussels, [and] said OK we're using the same book. What did they miss? So they want to learn from what has actually transpired in Europe," Borduas said.

Obama arrives in Ottawa Wednesday morning for the North American Leaders' Summit with Prime Minister Justin Trudeau and Mexican President Enrique Pena Nieto. He'll address Parliament late Wednesday afternoon before returning to D.C. in the evening.