050] How to Create Advanced Terrain Profiles from Global Mapper Using ChatGPT

Export raw elevation data from Global Mapper to CSV and use ChatGPT to generate professional, high-fidelity terrain cross-sections.

This tutorial demonstrates how to overcome the visual limitations of built-in GIS profile tools. By leveraging AI-driven Python scripting, you can create custom-shaded site areas, highlight steep slopes, and add precise leader-line annotations to your terrain analysis reports.

Exporting Path Profile Data from Global Mapper

Today, I’d like to share an experimental workflow for improving terrain profile visualization in Global Mapper.

First, please run Global Mapper.

DEM created in Global Mapper with a line segment added for profile analysis
img 1 : DEM created in Global Mapper with a line segment added for profile analysis

With the DEM created, add a line segment. Now, let's extract the terrain profile.

Accessing Path Profile through the Analysis/Measurement menu
img 2 : Accessing Path Profile through the Analysis/Measurement menu

After selecting the line segment, right-click and select Analysis/Measurement - Path PROFILE.

The Path Profile result window will appear.

Standard Path Profile result window in Global Mapper
img 3 : Standard Path Profile result window in Global Mapper

As you can see, the default profile visualization is fairly minimal. While it's functional enough to convey information, So I explored whether ChatGPT could be used to generate a cleaner and more presentation-ready terrain profile.

Saving Terrain Profile Data as CSV

To do this, save the results as a CSV file.

In the Path Profile window, go to File - Save Path to CSV File (XYZ, Distance, Slope).

A window asking for the save location will pop up.

Saving the terrain data as Terrain.csv
img 5 : Saving the terrain data as Terrain.csv

Enter a name and save it. Now, let's check the file in Notepad.

CSV data viewed in Notepad showing coordinates, elevation, and distance
img 6 : CSV data viewed in Notepad showing coordinates, elevation, and distance

Using ChatGPT to Generate Terrain Cross-Sections

Yes, it has been saved correctly. Now, log in to chatGPT (note: I am a paid user).

Upload the CSV file you just saved to the chat window and ask it to generate a graph.

Uploading the CSV to ChatGPT and requesting graph generation
img 7 : Uploading the CSV to ChatGPT and requesting graph generation

Custom Path Profile Guidelines for ChatGPT

The "Path Profile Guidelines" mentioned in the prompt are the following set of instructions that I "agreed" upon with chatGPT after considerable trial and error:

Custom Path Profile Guidelines for ChatGPT

1. Terrain Profile Graph Configuration

- X-axis: Distance (Total)
- Y-axis: Elevation Elevation
- curve: Solid black line Graph
- title: Do not display

2. Removing Default Slope Indicators

- Do not represent any lines or markings related to Slope.

3. Highlighting the Project Site Area

Based on the user-specified distance interval (Site): Fill the area under the elevation line for that interval with black semi-transparent shading (alpha=0.3). The shading should extend down to the minimum elevation grid tick (grid_y_min). Place the Site label "site": Centered in the site interval (X-axis). In the upper space to avoid overlapping with the elevation curve and shading. Color: Black, Alignment: Horizontally centered, bottom aligned.

4. Adding Elevation Labels with Leader Lines

Display the elevation values for the start and end points of the Site area using leader lines. Left (Start): Leader line pointing up-left / Right (End): Leader line pointing up-right. Text format: "XXX.X m", Color: Black.

5. Configuring Distance and Elevation Axes

- X-axis label ("Distance (m)"): labelpad ≈ -2 Y-axis (Elevation): Display ticks at 20m intervals, starting from 20m below the minimum elevation to 20m above the maximum elevation. Fix the axis scale to 1:1 to prevent visual distortion.

6. Final Visualization and Export Settings

- Do not use a legend. Enable grid lines. Save format: PNG (convert to PDF if necessary).

Generating Refined Terrain Profiles with ChatGPT

I saved these instructions as a text file and added them to the project files so chatGPT could refer to them. Here is the result:

Cleanly rendered terrain profile generated by ChatGPT
img 8 : Cleanly rendered terrain profile generated by ChatGPT

Looks clean, right? Now, I will set the project site range from 400m to 900m and redraw the graph.

Requesting ChatGPT to set the site range from 400-900m
img 9 : Requesting ChatGPT to set the site range from 400-900m

And the result?

Profile with shaded site area and boundary elevation labels
img 10 : Profile with shaded site area and boundary elevation labels

Following the guidelines, the project site is shaded, and the sea-level elevation at the boundaries is displayed. Let's try one more thing.

Highlighting Steep Slopes in Terrain Profiles

I'll mark areas within the site where the slope is 15 degrees or more with a red line.

Requesting ChatGPT to highlight slopes over 15 degrees in red
img 11 : Requesting ChatGPT to highlight slopes over 15 degrees in red

And the result?

Final graph with site shading, elevation labels, and red lines for steep slopes
img 12 : Final graph with site shading, elevation labels, and red lines for steep slopes

Why This Workflow Improves GIS Visualization

It rendered it perfectly. You can also adjust font size, grid intervals, and colors.

Because this workflow was refined through repeated interactions with ChatGPT, your results may vary depending on how detailed your instructions are. You'll need to talk to it and "teach" it diligently.

Depending on how detailed you make your instructions with chatGPT, expressions not provided by Global Mapper are entirely possible. Once the DEM is exported as XYZ or CSV data, the visualization possibilities become highly flexible. With properly structured prompts, ChatGPT can generate customized terrain analyses far beyond the default capabilities of Global Mapper. I'll have to try that when I have time.

That's all for today!

Continue Learning
Explore complete tutorial collections for CityEngine and Global Mapper.

Comments

Popular posts from this blog

029] How to Split Polygon Areas with Intersecting Lines in Global Mapper

[008] How to Understand CGA Rule Structure in CityEngine (Beginner Guide)

046] How to Create Parallel Offset Lines in Global Mapper