Currently there is a command in diag exe diag_getTerrainGrid. But that command is just a getter of terrain cell size and it's perfectly safe and useful for normal exe as well.
I had already asked for that command but sadly another newer ticket requesting the command to be added to diag exe was accepted.... :(
So instead, I'm gonna ask for a new command: getTerrainInfo, which is more general.
This command will return an array of 4 values: The terrain cell size, its heightmap resolution, world size, and the water level offset (due to tides): T164260.
[cellSize, heightMapResolution, worldSize, waterOffset]
This command can be further expanded in the future to return more useful terrain info. (I can't currently think of anything)
The cell size is an important attribute of the terrain. For example, you can know where the terrain "slope" is gonna change (which is the next adjacent cell triangle) compared to the current pos.
This feature can be useful for scripts that find "empty and flat positions", as currently there's no good approach to do this (if you pick small "step", the algorithm is slow; if you pick a large one, it's inaccurate...)
There are many other applications as well.