Skip to main content

Formula Reference for gPlan

Every name, operator, and function you can use in gPlan's formulas

Written by Holly Conrad Smith

Formulas let you measure what your plan needs to report, from floor space to dwelling yield to the number of sites over a minimum lot size. You write them in three places: metrics, rules that set a column to a formula, and a metric's only where condition.

Names you can use

Kind

What it is

Example

Column (C)

A column on your sites, from your layer or written by a rule. It is different on every site.

area, zoning

Land use field (L)

A value from the land use table, read through each site's land use.

far, height

Assumption (A)

One plan-wide number.

efficiency

Result (R)

Another metric's total. It only works in metrics.

Dwellings

Function (F)

A built-in function.

sum, round

How gPlan finds a value for a site

For each site, gPlan looks up a name in this order:

  1. A land use field read through a named column, such as upzoned.far.

  2. The site's own column with that name.

  3. The value of the site's land use in the active scenario.

  4. The global assumption with that name.

  5. Another metric's result with that name.

The global assumptions are far 2, efficiency 0.8, dwellingSizeSqm 100, residentsPerDwelling 2.5, and jobsPerSqm 0.05.

Write names in a formula

Type a name as it appears in your data or land use table, such as area or far. Put a name with spaces or symbols in square brackets, such as [Land Use].

Put a column name and a dot in front of a land use field to read it through that column's land uses. For example, upzoned.far reads the FAR of each site's land use in the upzoned scenario, whichever scenario is active. Type the column name and a dot, and gPlan suggests the fields.

Operators

Operator

What it does

+ - * /

Add, subtract, multiply, and divide.

( )

Group parts of a formula.

= !=

Is equal to, and is not equal to.

< <= > >=

Less than, at most, greater than, and at least.

and or

Join two conditions.

Put text in double quotes, such as "R2".

Add up sites with aggregates

A metric adds up a formula across your sites with an aggregate function. Columns and land use fields change from site to site, so they go inside the aggregate.

Function

What it does

Example

sum(formula)

Adds up the formula's value on every site.

sum(area * far)

avg(formula)

The average across sites.

avg(height)

min(formula)

The smallest value across sites.

min(area)

max(formula)

The largest value across sites.

max(height)

count()

How many sites there are.

count()

Filter an aggregate

Add a condition as the last argument of an aggregate to count only the sites that meet it. In count, the condition is the only argument.

  • sum(area, landUse = "Open Space") adds up the area of every Open Space site.

  • count(height > 20 and landUse != "Park") counts the sites taller than 20 m that aren't parks.

  • count(area >= 1000) counts the sites of 1,000 m² or more.

Maths functions

Function

What it does

round(x)

Rounds to the nearest whole number.

floor(x)

Rounds down.

ceil(x)

Rounds up.

abs(x)

Drops the minus sign.

sqrt(x)

The square root.

In a rule's formula, min(a, b) and max(a, b) give the smaller or the larger of their values. In a metric, min and max work across sites.

Example formulas

Where

Formula

What it gives

Metric

sum(area * far * efficiency / dwellingSizeSqm * cost) / 1000000

Build cost in millions.

Metric

avg(area)

Average lot size.

Metric

Dwellings * 2.4

Another metric's total, times 2.4.

Rule, to a formula

existing_height * 2

Double a site's height column.

Rule, to a formula

round(area * far / dwellingSizeSqm)

Dwellings on each site, as a whole number.

Did this answer your question?