# mapprofile

Interpolate between waypoints on regular data grid

## Syntax

`[zi,ri,lat,lon] = mapprofile`

[zi,ri,lat,lon] = mapprofile(Z,R,lat,lon)

[zi,ri,lat,lon] = mapprofile(Z,R,lat,lon,units)

[zi,ri,lat,lon] = mapprofile(Z,R,lat,lon,ellipsoid)

[zi,ri,lat,lon] = mapprofile(___,'trackmethod','interpmethod')

## Description

`mapprofile`

plots a profile of values between
waypoints on a displayed regular data grid. `mapprofile`

uses
the current object if it is a regular data grid, or the first regular
data grid found on the current axes. The grid's `zdata`

is
used for the profile. The color data is used in the absence of `zdata`

.
The result is displayed in a new figure.

`[zi,ri,lat,lon] = mapprofile`

returns the
values of the profile without displaying them. The output `zi`

contains
interpolated values along great circles between the waypoints. `ri`

is
a vector of associated distances from the first waypoint in units
of degrees of arc along the surface. `lat`

and `lon`

are
the corresponding latitudes and longitudes.

`[zi,ri,lat,lon] = mapprofile(Z,R,lat,lon)`

accepts
as input a regular data grid and waypoint vectors. No displayed grid
is required. Sets of waypoints may be separated by NaNs into line
sequences. The output ranges are measured from the first waypoint
within a sequence. `R`

can be a geographic raster
reference object, a referencing vector, or a referencing matrix.

If `R`

is a geographic raster reference object,
its `RasterSize`

property must be consistent with `size(Z)`

.

If `R`

is a referencing vector, it must be
a 1-by-3 with elements:

[cells/degree northern_latitude_limit western_longitude_limit]

If `R`

is a referencing matrix, it must be
3-by-2 and transform raster row and column indices to or from geographic
coordinates according to:

[lon lat] = [row col 1] * R

If `R`

is a referencing matrix, it must define
a (non-rotational, non-skewed) relationship in which each column of
the data grid falls along a meridian and each row falls along a parallel.

`[zi,ri,lat,lon] = mapprofile(Z,R,lat,lon,units)`

specifies
the units of the output ranges along the profile. Valid range units
inputs are any distance value recognized by `unitsratio`

.
Surface distances are computed using the default radius of the earth.
If omitted, `'degrees'`

are assumed.

`[zi,ri,lat,lon] = mapprofile(Z,R,lat,lon,ellipsoid)`

uses the provided ellipsoid definition in computing the range along the profile.
`ellipsoid`

is a `referenceSphere`

, `referenceEllipsoid`

, or `oblateSpheroid`

object, or a vector of the form ```
[semimajor_axis
eccentricity]
```

. The output range is reported in the same distance units as the
semimajor axes of the ellipsoid. If you do not specify `ellipsoid`

and
`R`

is a reference object with a nonempty
`GeographicCRS`

property, then `mapprofile`

uses the
ellipsoid contained in the `Spheroid`

property of the
`geocrs`

object in the `GeographicCRS`

property of
`R`

. Otherwise, `mapprofile`

uses the unit
sphere.

`[zi,ri,lat,lon] = mapprofile(___,'trackmethod','interpmethod')`

control
the interpolation methods used. Valid track methods are `'gc'`

for
great circle tracks between waypoints, and `'rh'`

for
rhumb lines. Valid methods for interpolation within the matrix are `'bilinear'`

for
linear interpolation, `'bicubic'`

for cubic interpolation,
and `'nearest'`

for nearest neighbor interpolation.
If omitted, `'gc'`

and `'bilinear'`

are
assumed.