In the present paper, we use modified shallow water equations (SWE) to reconstruct the bottom topography (also called bathymetry) of a flow domain without resorting to traditional inverse modeling techniques such as adjoint methods. The discretization in space is performed using a piecewise linear discontinuous Galerkin (DG) approximation of the free surface elevation and (linear) continuous finite elements for the bathymetry. Our approach guarantees compatibility of the discrete forward and inverse problems: for a given DG solution of the forward SWE problem, the underlying continuous bathymetry can be recovered exactly. To ensure well-posedness of the modified SWE and reduce sensitivity of the results to noisy data, a regularization term is added to the equation for the water height. A numerical study is performed to demonstrate the ability of the proposed method to recover bathymetry in a robust and accurate manner.