A Swiss city has apologised to a transgender woman after six of its police officers threw her out of a female-only nudist bathing area.