# areaint

Surface area of polygon on sphere or ellipsoid

## Syntax

```area = areaint(lat,lon) area = areaint(lat,lon,ellipsoid) area = areaint(lat,lon,units) area = areaint(lat,lon,ellipsoid,units) ```

## Description

`area = areaint(lat,lon)` calculates the spherical surface area of the polygon specified by the input vectors `lat` and `lon`. The calculation uses a line integral approach. The output, `area`, is the fraction of surface area covered by the polygon on a unit sphere. To supply multiple polygons, separate the polygons by NaNs in the input vectors. Accuracy of the integration method is inversely proportional to the distance between lat/lon points.

`area = areaint(lat,lon,ellipsoid)` calculates the surface area of the polygon on the ellipsoid or sphere defined by the input `ellipsoid`, which can be a `referenceSphere`, `referenceEllipsoid`, or `oblateSpheroid` object, or a vector of the form ```[semimajor_axis eccentricity]```. The output, `area`, is in squares units corresponding to the units of `ellipsoid`.

`area = areaint(lat,lon,units)` uses the units defined by `units`, the string scalar or character vector `'degrees'` or `'radians'`. If omitted, default units of degrees are assumed.

`area = areaint(lat,lon,ellipsoid,units)` uses both the inputs `ellipsoid` and `units` in the calculation.

## Examples

Consider the area enclosed by a 30º lune from pole to pole and bounded by the prime meridian and 30ºE. You can use the function `areaquad` to get an exact solution:

```area = areaquad(90,0,-90,30) area = 0.0833```

This is 1/12 the spherical area. The more points used to define this polygon, the more integration steps `areaint` takes, improving the estimate. This first attempt takes a point every 30º of latitude:

```lats = [-90:30:90,60:-30:-60]'; lons = [zeros(1,7), 30*ones(1,5)]'; area = areaint(lats,lons) area = 0.0792```

Now, calculate a better estimate, with one point every 1º of latitude:

```lats = [-90:1:90,89:-1:-89]'; lons = [zeros(1,181), 30*ones(1,179)]'; area = areaint(lats,lons) area = 0.0833```

## Tips

Regardless of the polygon vertex order, the values returned by `areaint` are positive.

## Algorithms

This function enables the measurement of areas enclosed by arbitrary polygons. This is a numerical estimate, using a line integral based on Green's Theorem. As such, it is limited by the accuracy and resolution of the input data. Given sufficient data, the `areaint` function is the best method for determining the areas of complex polygons, such as continents, cloud cover, and other natural or derived features. The calculations in this function employ a spherical Earth assumption. For nonspherical ellipsoids, the latitude data is converted to the auxiliary authalic sphere.

### Topics

Introduced before R2006a

## Support Get trial now