Well, you need to check for water with 092E
. If water height is higher than the ground height, the position is probably above water.
I'd think the Z coord would make the command, only return heights below it. Though -100.0 as a Z coord is known to do this job for the highest ground in this and many other commands (such as create_char).
However, one infamous problem occurring from this happens when the area of the position of the map you're trying to get the height of isn't loaded. It would work perfectly in an area in CJ's range, though. So to get the coordinates you first need to load the scene
Keeping the scene loaded can be a bit of an issue though. If the area is not near the player, it'll just be streamed out. You specifically want the collision to stay loaded. If you know the part of the map you're getting the height of, this is completely avoidable by using LOAD_MODEL with the model IDs used to make up at that point. I have no ultimate solution (or I may have, but have forgotten the specifics) for the other, though my interest was to keep the map loaded during camera movement. On the other hand, LOAD_SCENE may work fine for you if you only nees it to get the ground height. If you want to teleport there, you have to try to make it happen without falling below the ground.
EDIT: Posting on mobile, I may be able to find a definite solution when I get back on PC.