A magnetic field sensor is provided alongside a roadway in order to detect vehicles. A permanent magnet is installed in the roadway at such a distance from the magnetic field sensor that the magnetic field of the permanent magnet is stronger than the geomagnetic field at the magnetic field sensor