There is Swyter's Cartographer for that job which is
open source.
Quite a long time ago, i tried to figure out the 'map.txt' file's content to create a simple 2d image of the maps. It sucked though and i discarded the related code
'map.txt file' has two parts.
First is a list of points.
Count of points then list of triple value tuples which represent x, y, z of values of that point.
Second is list of triangles.
Count of rectangles then list of 6 value tuples. First is the texture to fill the rectangle. Second and third look like always 0 and 3. I don't know what they are exactly. Last 3 values are corners of the rectangle. They are index values which refers to the points at the first part.
You can figure out what those textures refer to in the 'header_ground_types.py' file in the module system. 'module.ini' file in the mod folder also has some variables related to the map.
That's all i know
You can learn more by checking the source code of Swyter's tool.
Edit: After writing all these stuff i realized you're most likely asking for the terrain in the scenes not the world map