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. |
|
Land use field (L) | A value from the land use table, read through each site's land use. |
|
Assumption (A) | One plan-wide number. |
|
Result (R) | Another metric's total. It only works in metrics. |
|
Function (F) | A built-in function. |
|
How gPlan finds a value for a site
For each site, gPlan looks up a name in this order:
A land use field read through a named column, such as
upzoned.far.The site's own column with that name.
The value of the site's land use in the active scenario.
The global assumption with that name.
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. |
| 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 |
|---|---|---|
| Adds up the formula's value on every site. |
|
| The average across sites. |
|
| The smallest value across sites. |
|
| The largest value across sites. |
|
| How many sites there are. |
|
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 |
|---|---|
| Rounds to the nearest whole number. |
| Rounds down. |
| Rounds up. |
| Drops the minus sign. |
| 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 |
| Build cost in millions. |
Metric |
| Average lot size. |
Metric |
| Another metric's total, times 2.4. |
Rule, to a formula |
| Double a site's height column. |
Rule, to a formula |
| Dwellings on each site, as a whole number. |