fieldarea provides a convenient way for Stata users to compute areas of irregularly-shaped fields from the GPS coordinates of their vertices.
fieldarea processes GPS data describing boundaries of plots (parcels). The coordinates (latitude and longitude) of vertices are assumed to be stored in degrees (and fractions of degrees). If the file describes multiple parcels, it must also contain a single ID variable, inentifying the parcel. Numeric and string ID variables are permitted.
fieldarea approximates parcels with polygons and collapses the dataset of vertex coordinates to a plot-level dataset computing the area of (each) plot as an area of a polygon. The area is reported in square meters by default, but other units can be requested with the optional unit() specification. Possible values for units are:
fieldarea is aware that the Earth is not flat, and corrects the length of latitude and longitude degrees separately for each plot depending on its latitude. However, for the same plot the length of a degree is assumed constant (which is reasonable for agricultural fields and residential land parcels, but may not be applicable to large areas such as countries, reserves, seas, etc). The correction is based on the WGS84 model.
For polygons containing only 1 or 2 boundary points, the area is calculated as zero. This situation is technically allowed, but may be a symptom of incorrect data entry.
This computational routing does not support self-intersecting polygons:
This is a common restriction for algorithms of this kind. You may decide to treat them as two or more simple (non self-intersecting) polygons.
Stata 9.2 or newer is required for this command. fieldarea is
available from
SSC.
To install it, type in Stata
findit fieldarea
and follow the links to install the module.
Fieldarea modifies your data! Make sure you have saved your data before calling this command.
To compute an area of a single field, write in Stata:
fieldarea longvar latvar, generate(area)
In the above the existing variables longvar and latvar should store the longitudes and latitudes of the vertices, and area is a variable to be created which will store the resulting area.
For example:
do "http://www.radyakin.org/stata/fieldarea/fieldarea_ex_jbuilding.do"
A more common case is to compute areas of multiple plots in the
dataset at one go. In that case the vertices of the same plot must
carry the same ID, and a corresponding option must be added to fieldarea:
fieldarea longvar latvar, generate(area) id(id)
Where id is an identifier of the plot. As a result the dataset will be reduced to two variables: id and area.
v1.0.1 (released Oct 13, 2016) fixes the problem with polygons listing the points in counter-clockwise order. The updated version produces correct area estimates regardless of the order of points (clockwise or counter-clockwise).
fieldarea was written by Sergiy Radyakin, Economist, The World Bank.