A new method for the detection of the geometrical information by the scanning tunneling microscope is proposed. In addition to the bias voltage, a small ac modulation is applied. The nonlinear dependence of the transmission coefficient on the applied voltage is used to generate harmonics. The ratio of the harmonics to the dc current is found to give the width between the sample and the probe, i.e., the geometrical information. This method may be useful to measure materials, where the local-spatial-density of states may change notably from place to place. ©1997 American Institute of Physics.