Mapping Toolbox | ![]() ![]() |
Determine geographic area of matrix element
Syntax
[area,areavec] = areamat(map,maplegend) [area,areavec] = areamat(map,maplegend,geoid) [area,areavec] = areamat(map,maplegend,units) [area,areavec] = areamat(map,maplegend,geoid,units)
Description
Given a regular matrix map that is a logical 0-1 matrix, the areamat
function will return the area corresponding to the true, or 1, elements. The input matrix map can be a logical statement, such as (topo>0),
which is 1 everywhere that topo
is
greater than 0 meters, and zero everywhere else. This is an illustration of that matrix:
[area,areavec] = areamat(map,maplegend) returns the surface area corresponding to the entries equal to 1 in the regular matrix map, map
, with a three-element map legend vector maplegend
. The output area
is a fraction of the unit sphere's area of 4, so the result ranges from 0 to 1. Since the area of a given cell is the same within any row of the matrix, the second output,
areavec
, can be useful. It is a vector, having the length of a column of map
, that provides the cell areas for each row, regardless of whether any element of that row is a 1.
[area,areavec] = areamat(map,maplegend,geoid) allows the specification of the geoid model with the two-element geoid vector geoid
. When a geoid
is input, the resulting area
is given in terms of the (squared) units of the geoid
. For example, if the geoid almanac('earth','geoid','kilometers')
is used, the resulting area will be in km2. The default geoid is the unit sphere.
area = areaint(lats,longs,geoid,units
) specifies the units of the inputs of
the map legend, which are 'degrees'
by default.
Examples
Approximately 24% of the Earth has an altitude greater than 127 meters. What is the surface area of this portion of the Earth in square kilometers if a spherical geoid is assumed? (use the almanac
function with the sphere as its reference body).
earthgeoid = almanac('earth','geoid','km','sphere');
area = areamat((topo>127),topolegend,earthgeoid)
area =
1.2299e+08
To illustrate the areavec
output, consider a smaller map:
map = ones(9,18); maplegend = [.05 90 0] % each cell 20x20 degrees [area,areavec] = areamat(map,maplegend) area = 1.0000 areavec = 0.0017 0.0048 0.0074 0.0091 0.0096 0.0091 0.0074 0.0048 0.0017
Each entry of areavec
represents the portion of the unit sphere's total area a cell in that row of map would contribute. Since the column extends from pole to pole in this case, it is symmetric.
Remarks
This calculation is based on the areaquad
command and is therefore limited only by the granularity of the cellular data resolution and the spherical Earth assumption. For nonspherical geoids, the latitude data is converted to the auxiliary authalic sphere.
See Also
almanac
Planetary data
areaint
areaquad
Other area calculations
![]() | areaint | areaquad | ![]() |