# distortcalc

Distortion parameters for map projections

## Syntax

``areascale = distortcalc(lat,lon)``
``areascale = distortcalc(mstruct,lat,lon)``
``[areascale,maxangdef,maxscale,minscale,merscale,parscale] = distortcalc(___)``

## Description

````areascale = distortcalc(lat,lon)` calculates the area scale of the current map projection at the locations specified by `lat` and `lon`. Area scale is a standard way to quantify the local area distortion introduced by a map projection.```

example

````areascale = distortcalc(mstruct,lat,lon)` uses the projection defined by the map projection structure `mstruct`.```
````[areascale,maxangdef,maxscale,minscale,merscale,parscale] = distortcalc(___)` calculates the area scale, the maximum angular deformation, the maximum and minimum particular scale distortions, the particular scale along the meridian, and the particular scale along the parallel using any combinations of input arguments from previous syntaxes.```

## Examples

collapse all

Create a map projection structure for the Mercator projection. The Mercator projection is conformal, which means that it preserves angles.

```mstruct = defaultm("mercator"); mstruct = defaultm(mstruct);```

Calculate the area scale and maximum angular distortion for a point on the equator. At this location, the Mercator projection has no area distortion.

`[areascale1,maxangdef1] = distortcalc(mstruct,0,0)`
```areascale1 = 1.0000 ```
```maxangdef1 = 0 ```

Calculate the area scale and maximum angular distortion again, this time for a point `60` degrees north. At this location, the Mercator projection shows regions at 400% of their true area.

`[areascale2,maxangdef2] = distortcalc(mstruct,60,0)`
```areascale2 = 4.0000 ```
```maxangdef2 = 0 ```

For both calculations, the `distortcalc` function indicates no angular distortion. This result is expected for conformal projections.

## Input Arguments

collapse all

Latitude coordinates, specified as a scalar, vector, or array. The size of `lat` must match the size of `lon`. Specify values using units that match the angle units of the map projection.

Longitude coordinates, specified as a scalar, vector, or array. The size of `lon` must match the size of `lat`. Specify values using units that match the angle units of the map projection.

Map projection structure, specified as a structure with fields identical to the properties of an `axesm`-based map. Map projection structure fields include, for example, the projection name, angle unit, origin, aspect, false easting, and false northing. For more information about the properties of `axesm`-based maps, see axesm-Based Map Properties.

Create a map projection structure by using the `defaultm` function, or extract the map projection structure from an `axesm`-based map by using the `gcm` function.

## Output Arguments

collapse all

Area scale, returned as a scalar, vector, or array of the same size as `lat` and `lon`.

The area scale is the ratio pArea/sArea, where sArea is the area of an infinitesimal quadrangle on the spheroid and pArea is the area of its projection in the map plane.

A value of `1` indicates no scale distortion.

Maximum angular deformation, returned as a scalar, vector, or array of the same size as `lat` and `lon`. The units match the angle units of the map projection.

Maximum particular scale distortion, returned as a scalar, vector, or array of the same size as `lat` and `lon`. This value is unitless.

Minimum particular scale distortion, returned as a scalar, vector, or array of the same size as `lat` and `lon`. This value is unitless.

Particular scale along the meridian, returned as a scalar, vector, or array of the same size as `lat` and `lon`. This value is unitless.

Particular scale along the parallel, returned as a scalar, vector, or array of the same size as `lat` and `lon`. This value is unitless.

collapse all

### Distortion

Except in a few special locations, all map projections distort shapes when transforming the shapes from the globe to the plane. The amount and type of distortion depends on the projection, the location on the globe, and the values of the projection parameters. The `distortcalc` function enables you to quantify local distortions using various standard metrics.

## Algorithms

• The `distortcalc` function uses a first difference technique.

• The function calculates the distortion parameters by slightly perturbing the input point locations in different directions and then projecting them.

• The results can contain a small amount of imprecision due to the function numerically computing derivatives.

## Version History

Introduced before R2006a