# ProportionAvg

## Description

Computes the average of an aggregation of values which are adjusted based on the proportion of two geometry objects.

## Syntax

ProportionAvg ( n, value_geometry, reference_geometry )

## Arguments

`n` is a numeric expression,

`value_geometry` is a geometry expression, and

`reference_geometry` is a geometry expression.

## Example

Returns the proportional average between two geometry values (one an envelope using MI_Box, the other passing in a geometry object).

`select ProportionAvg(1, obj, MI_Box(-104.493426, 39.399710, -101.282362, 41.474182, 'epsg:4269')) as ProportionAvg from states`

## Remarks

ProportionAvg is an aggregation function which can only be used in an aggregating `Select` statement. Null values for `n`, `value_geometry`, and/or `reference_geometry` are ignored. If there are only null values supplied in the aggregation, then a null value is returned.

For instances where there is no overlap of geometries, the row is still counted for the average.

The values of `n` times a proportion are accumulated and averaged. The proportion is determined to be the area of the overlap of the `value_geometry` and the `reference_geometry` divided by the area of the `value_geometry`.

The ProportionAvg aggregation function can be replaced with the following formula:

`Avg (n * AreaOverlap(value_geometry, reference_geometry)) / Area(value_geometry)) `

`AreaOverlap(value_geometry, reference_geometry))`

is also referred to as
`Area(Intersection(value_geometry, reference_geometry))`

.

If the coordinate system of the `value_geometry` is Non-Earth, a Cartesian area calculation will be performed.