1. Home
  2. PTAREAPOLYGON procedure

PTAREAPOLYGON procedure

Calculates the area of a polygon (M.A. Mugglestone, S.A. Harding, B.Y.Y. Lee, P.J. Diggle & B.S. Rowlingson).

Option

PRINT = string token What to print (summary); default summ

Parameters

YPOLYGON = variates Vertical coordinates of each polygon; no default – this parameter must be set
XPOLYGON = variates Horizontal coordinates of each polygon; no default – this parameter must be set
AREA = scalars Scalars to receive the areas of the polygons

Description

This procedure takes as input two variates containing the coordinates of a polygon (specified by the XPOLYGON and YPOLYGON parameters) and returns the area of the polygon. The area may be saved in a scalar specified using the parameter AREA.

Printed output is controlled by the PRINT option. The default setting of summary prints the area of the polygon under the heading AREA.

Option: PRINT.

Parameters: YPOLYGON, XPOLYGON, AREA.

Method

A procedure PTCHECKXY is called to check that XPOLYGON and YPOLYGON have identical restrictions. PTAREAPOLYGON then calls PTCLOSEPOLYGON to close the polygon specified by XPOLYGON and YPOLYGON. It then calls a procedure PTPASS to call a Fortran program to calculate the area of the polygon.

Action with RESTRICT

If XPOLYGON and YPOLYGON are restricted, only the subset of values specified by the restriction will be used in the calculations.

See also

Procedures: DPOLYGON, PTAREAPOLYGON, PTCLOSEPOLYGON, PTSINPOLYGON.

Commands for: Spatial statistics.

Example

CAPTION 'PTAREAPOLYGON example'; STYLE=meta
VARIATE xpoly; VALUES=!(0.0,0.5,0.5,0.0)
&       ypoly; VALUES=!(0.0,0.0,0.5,0.5)
PTAREAPOLYGON YPOLYGON=ypoly; XPOLYGON=xpoly
Updated on March 6, 2019

Was this article helpful?