Depth-mapping inversion of gravity or magnetic fields generally assumes that anomalies originate from a main density or magnetization contrast interface. This particular inversion takes into account inhomogeneous density or magnetization distributions reflecting sediment compaction and basement heterogeneities: above the interface, the density can be approximated by an exponential function, and below it, an intrabasement contrast map can be used. The inversion also integrates local depth constraints from wells or seismic data, as well as general constraints set on the geometry and the contrast of the interface. After field transformations, spectral analysis and con-straints help to define a starting model characterized mainly by the interface mean depth and the mean parameter contrast between the two media. The depth adjustment is completed iteratively under constraints using a space-domain formulation derived from the Bouguer-slab approximation. The interface model effect is computed in the wavenumber domain. A model data example shows the accuracy of the inversion and illustrates the role of the constraints. In a field example of a basin area where constraints can be derived from numerous well data, successive inversions of gravity data result in an isodepth map of the basement. The compatibility of the map with local depth constraints from wells is obtained by taking into account density heterogeneities related to known lithologic variations in the basement.