Access to export Heightmap Raw Function / automatic call via script

Hi Folks,

We would like to import terrain data into another technology.
To do that, we have to make a coord transformation e.g. we have to negate the z-coordinate.
Afterwards we have to cook a physX.bin (collision mesh).
We need to change the raw data directly or use the raw data to create a z-negated raw file.

So this leads two the following questions:

is there any way to have access to the terrain function “Export Heightmap Raw…”?
is there any way to call the original function via script?
Is there any alternative?

Thanks in front for your answers.

You could sample everything using Unity - Scripting API: TerrainData.GetHeights

thank you.
I have then a further question which function give me the value of the resolution of one heightmap sample?
is it TerrainData.heightmapScale ?