In contrast, Joe Biden, the US Vice-President, won warm applause when he praised the dedication of officers such as Ramos and acknowledged the divisions in society.
"I believe that this great police force in this incredibly diverse city can and will show the nation how to bridge any divide," he said.
Just before the shooting, the gunman Ismaaiyl Brinsley, 28, posted online comments threatening police, and promising revenge for Garner and Michael Brown, shot dead by police in Missouri.
Three hours before the funeral started, mourners stretched for more than six blocks, many in their blue police uniforms. They travelled from across the US and Canada, helped by an offer from an airline to fly two officers for free from each local police department.
An estimated 25,000 people assembled for the funeral, one of the largest for an officer killed in the line of duty in the city.
Officers have been on high alert for the past week, wary of copycat attacks.