A general method for an explicit determination of the shape of the earth from gravimetric data