Skip to main content

Write Rules in gPlan

Give land uses to sites in bulk, and work out new columns, with Where and Then rules

Written by Holly Conrad Smith

Rules turn planning policy into data. A rule says which sites it applies to, such as "R2 lots over 500 m²", and what to write on them, such as "Medium density". One rule can rezone hundreds of sites at once, and changing it updates every result.

Add a rule

Rules belong to a scenario, so start by opening the scenario you are writing. See Scenarios in gPlan.

  1. Click the 3 · Scenarios tab and click the scenario's tab.

  2. Click the green + Add rule button at the top right of the Scenarios section. A card named "New rule" appears.

  3. Click the name and type one your colleagues will understand, such as "Upzone large R2 lots".

Each rule card has two parts. Where picks the sites, and Then says what to write on them. Rules run on the sites in your working shortlist, so build or load one first. See Build a Shortlist in gPlan.

Choose which sites the rule applies to

The Where box holds the rule's conditions. A rule with no conditions applies to every site, which is useful for a default land use.

  1. Click + condition.

  2. Click the column name and search for the column to test, such as zoning or area. A column marked "no data" has no value on any loaded site.

  3. Pick an operator, such as is or at least.

  4. Type or pick the value. gPlan suggests the values it finds on your sites. To get suggestions from every site, click Summarize in the Data preview first.

Click + condition again to narrow the rule further. Conditions are joined by and, so a site must meet all of them. Click × at the end of a condition to remove it.

Operators for each type of column

The operators a condition offers depend on the type of column it tests:

Column type

Operators

Number

is, is not, greater than, at least, less than, at most, between, is empty, is not empty

Text

is, is not, contains, does not contain, starts with, is one of, is none of, is empty, is not empty

Text with a fixed list of values

is, is not, is one of, is none of, is empty, is not empty

Date

is, greater than, at least, less than, at most, between, in the last, is empty, is not empty

Yes / no

is, is empty, is not empty

Use is one of to match several values in one condition, such as zones R2 and R3, and between to set a low and a high number. When a number column is stored as text, number operators don't work on it. Change its type in the Data preview first. See The Data Preview in gPlan.

Match any of several conditions

Sometimes a site should qualify in more than one way, such as "zoned R3, or on a lot of 1,000 m² or more". Click the word and between two conditions to switch it to or. Conditions joined by or sit together in a dashed any of box, and a site only needs to meet one of them. Click or to switch it back to and.

Choose what the rule writes

With the sites chosen, the Then box says what to write on them. It reads "set", then a column, then how to set it, then the value. The column starts as the scenario's own column. Pick how to set it:

  • to a land use: pick a land use from the land use table. This is the default and the most common choice.

  • to a value: type any value, such as R3 or 12.

  • to a formula: type a formula worked out for each site, such as existing_height * 2. See Formula Reference for gPlan.

Click × at the end of the Then box to clear its value.

Set a value for the sites that don't match

A rule can also cover every site its conditions miss, such as "R2 lots over 500 m² become Medium density, and every other lot stays Low density".

  1. Click + else clause at the bottom of the card.

  2. Set the Else box the same way as Then.

Else writes to every site the conditions don't match. Click × on the Else box to remove it.

Check what a rule did

gPlan runs your rules a moment after you stop editing. Each card then shows how many sites its conditions matched, such as "12 fired". A rule that shows "0 fired" matched no site, so check its conditions. A red line under a card explains a rule gPlan can't run, such as a formula it can't read.

To see the result site by site, open the Data preview. The columns your rules write are marked rule. See The Data Preview in gPlan. To make several changes before gPlan reruns, click Pause in the header, and click Resume when you are done.

How rules work together

A scenario usually needs several rules, one for each part of the policy. Rules run from top to bottom, scenario by scenario. When two rules write the same column on a site, the later one wins. A rule's Where can also test a column that an earlier rule wrote. Click ↑ or ↓ at the top right of a card to move it up or down within its scenario.

To make a general rule that only fills the gaps, tick only if column not already set (fallthrough) on it. The rule then skips any site an earlier rule already wrote to. Put specific rules first and the general one last with this box ticked.

A rule can also write a column other than the scenario's, such as a setback or a height for each site. Click the column name in Then, and pick another column or type a new name. The rule moves to that column's tab, and gPlan switches to it, adding a tab when there isn't one. A site's own column wins over its land use's value. In an Else box, a different column shows a ↺ button. Click it to write to the scenario's column again.

Manage your rules

As a scenario grows, a few controls keep it tidy. On wide panels, rule cards sit side by side.

  • Copy a rule: click ⧉. The copy sits under the original, with "(copy)" after its name.

  • Turn a rule off: click the switch to test the scenario without it. A rule that is off doesn't run.

  • Fold a rule: click the arrow at the left of the name. The card folds to a one-line summary, such as "set landUse = Medium density". Click the arrow or the summary to open it.

  • Delete a rule: click × at the top right of the card.

Describe a rule in plain English

When you know the policy and not the columns, describe the rule and let gPlan draft it.

  1. Type the rule in the box above the rules, such as "for R2 lots under 500m², set new_zoning to R3".

  2. Click Add rule, or press Enter.

  3. Wait while gPlan asks Claude to build the rule. gPlan adds it to the active scenario.

  4. Check the conditions and action it made before you rely on it.

This needs an Anthropic credential. See gPlan Settings.

Did this answer your question?