Example of how the police can search your car without a warrant or your consent [video]

IANAL, but I know in the town where I live uniformed officers are legally obligated to show their badge, and give their badge number and name if asked. This is according to several officers on the force I’ve met, and it’s apparently a city ordinance. Before it was legislated, it was simply part of the department policy.
I don’t know if it’s reinforcing state or federal law though, or if there is state or federal laws requiring police to identify themselves with proper ID.