What is the way to reconstruct a height map from a metric? Say you have a 2D surface which asymptotically approaches a plane in all directions.
It has some coordinates on it, $x$ and $y$, (not necessarily Cartesian).
You can construct a height map $Z(x,y)$. To create a hilly terrain.
Assume the function $Z$ is analytic so that it is smooth.
Now you can calculate the 2D intrinsic metric of this surface $g_{ab}(x,y)$ 
(Let $X(x,y),Y(x,y)$ be a cartesian coordinate system written in terms of the coordinates $x$ and $y$ then $g_{ab}(x,y) =  \partial_a X \partial_b X + \partial_a Y \partial_b Y +\partial_a Z \partial_b Z)$
If you gave someone just this metric how would they reconstruct the height map $Z$? i.e. reconstruct the function $Z$ from the metric? (Up to a reflection in the xy plane and translation in the z axis).
One case is easy, that is you could work out the Ricci curvature tensor and if it is zero then the height map is constant, it is a flat plane.
What about the general case? (Some cases might be degenerate but a simply hill should be able to be reconstructed from the metric?)
 A: If you know the metric of a graph in $X,Y$ coordinates then we can recover $Z$ up to vertical translation/reflection as you said, but it turns out to rely crucially on $Z$ being analytic. (Not just smooth!) Since $$g(v,v) = |v|^2 + (v \cdot \nabla Z)^2$$ for any vector $v$ in the $X,Y$ plane, we can find $\nabla Z|_p$ up to a sign by maximizing $\sqrt{g_p(v,v) - |v|^2}$ over unit vectors $v.$ Once we know the gradient of a function we know the function up to a constant (vertical translation); but there's a glitch here: we only know $\nabla Z$ up to a sign at each point, and this sign could change from point to point. 
For example, if we weren't requiring $Z$ to be smooth, then the two graphs $Z(X,Y) = X^2$ and $Z(X,Y) = |X|X$ would provide a counterexample. You should be able to get a smooth but non-analytic counterexample by playing with $\exp(-1/X)$ instead of $X^2.$
To fix this up, start by noticing that on an open connected domain where $\nabla Z$ is non-zero and continuous, knowing $\nabla Z$ at one point and $\pm \nabla Z$ everywhere determines $\nabla Z$ everywhere. So either $\nabla Z$ is zero everywhere (in which case we know the surface is a horizontal plane), or there is some point $p$ at which $\nabla Z$ is non-zero. By continuity there must be some disc $\Omega$ about $p$ on which $\nabla Z$ is non-zero, so we know $\nabla Z|_{\Omega}$ up to a global sign and thus $Z|_\Omega$ up to a sign and an additive constant. Since we are assuming $Z$ is analytic, by the unique continuation principle its values on the open set $\Omega$ determine its values
everywhere, so we are done.
If you know the metric in some other coordinates $x,y$ and you know how $x,y$ are related to $X,Y$, then you can first convert the metric to $X,Y$ coordinates and then follow the above. If you only know the metric in some arbitrary coordinates $x,y$ without knowing the dependence of $X,Y$ on $x,y,$ then you're pretty clearly out of luck: for example, any height function $Z(X)$ not depending on $Y$ produces a graph which is intrinsically flat, meaning you can choose coordinates $x(X), y(Y) = Y$ so that $g_{ab} = \delta_{ab}.$ (Note that this also shows your remark about vanishing Ricci curvature is false.)
