Documentation

## Compute Elevation Profile Along Straight Line

This example shows how to compute an elevation profile along a straight line using the `mapprofile` function. Calculating data values along a path is a common application when working with gridded geodata. For example, you might want to calculate the terrain height along a transect, a road, or a flight path. The `mapprofile` function does this, based on numerical data defining a set of waypoints, or by defining them interactively via graphic input from a map display. Values computed for the resulting profile can be displayed in a new plot or returned as output arguments for further analysis or display.

Load the Korean elevation data MAT-file.

`load korea`

Get the latitude and longitude limits using `limitm` and use them to set up a map frame via `worldmap`. `worldmap` plots only the map frame.

```[latlim, lonlim] = limitm(map, maplegend); figure worldmap(latlim, lonlim)```

Render the map and apply a digital elevation model (DEM) colormap to it.

```meshm(map,maplegend,size(map),map) demcmap(map)```

Define endpoints for a straight-line transect through the region.

```plat = [40.5 30.7]; plon = [121.5 133.5];```

Compute the elevation profile, using the `mapprofile` function with the default track type, `great circle`, and the default interpolation type, `bilinear`.

`[z,rng,lat,lon] = mapprofile(map,maplegend,plat,plon);`

Draw the transect in 3-D so it follows the terrain.

`plot3m(lat,lon,z,'w','LineWidth',2)`

Construct a plot of transect elevation and range.

```figure plot(rng,z,'r')```

Get trial now