> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ploterr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Zoning evaluation

> Calculate the buildable volume and test a mass against the rules.

## Import

```typescript theme={null}
import {
  evaluateZoning,
  buildableFootprint,
  buildableEnvelope,
  resolvedLotLines,
  edgeSetbacks,
  requiredInset,
  heightCapOf,
  planeOffsetAt,
} from '@opengeometry/floorkit';
```

## evaluateZoning

Evaluate `rules` for `masses` on `site`.

```typescript theme={null}
function evaluateZoning(site: SiteLike, masses: MassLike[], rules: ZoningRuleSet): ZoningReport;
```

## buildableFootprint

The buildable plate(s) at `atHeight` above grade — the parcel inset per edge by the rules, holes grown by theirs.

```typescript theme={null}
function buildableFootprint(
  site: SiteLike,
  rules: ZoningRuleSet,
  atHeight?: number,
): PolygonProfile[];
```

## buildableEnvelope

Stack buildable plates from grade to the height cap (or `opts.maxHeight`) in `bandHeight` bands; stops at the first band with no buildable region.

```typescript theme={null}
function buildableEnvelope(
  site: SiteLike,
  rules: ZoningRuleSet,
  opts?: {
    bandHeight?: number;
    maxHeight?: number;
  },
): BuildableEnvelope;
```

## resolvedLotLines

Resolved lot-line classes (every edge `side` when the site has none).

```typescript theme={null}
function resolvedLotLines(site: SiteLike): LotLineClass[];
```

## edgeSetbacks

Per-edge insets at `atHeight` above grade: one per outer edge, one list per hole.

```typescript theme={null}
function edgeSetbacks(
  site: SiteLike,
  rules: ZoningRuleSet,
  atHeight?: number,
): {
  outer: number[];
  holes: number[][];
};
```

## requiredInset

Largest inset among the plane rules addressing `edgeClass` at `atHeight`.

```typescript theme={null}
function requiredInset(rules: ZoningRuleSet, edgeClass: LotLineClass, atHeight: number): number;
```

## heightCapOf

Height cap above grade, when a `height-cap` rule exists (the smallest wins).

```typescript theme={null}
function heightCapOf(rules: ZoningRuleSet): number | undefined;
```

## planeOffsetAt

Inset one plane rule demands at `atHeight` above grade.

```typescript theme={null}
function planeOffsetAt(rule: EnvelopePlaneRule, atHeight: number): number;
```

## Types

### SiteLike

The structural shape the envelope needs — a `Site`'s config or a plain object.

```typescript theme={null}
interface SiteLike {
  profile: PolygonProfile;
  lotLines?: LotLineClass[];
  elevation?: number;
}
```

### ZoningReport

```typescript theme={null}
interface ZoningReport {
  compliant: boolean;
  violations: ZoningViolation[];
  failureClass: ZoningViolationType | null;
  metrics: ZoningMetrics;
}
```

### EnvelopePlaneRule

```typescript theme={null}
interface EnvelopePlaneRule {
  kind: 'envelope-plane';
  id: string;
  edgeClass: LotLineClass | 'all';
  offsetAtGrade: number;
  startHeight?: number;
  slopeDeg?: number;
}
```

<ResponseField name="kind" type="&#x22;envelope-plane&#x22;" required />

<ResponseField name="id" type="string" required />

<ResponseField name="edgeClass" type="LotLineClass | &#x22;all&#x22;" required>
  Which lot lines the plane rises from. `all` = every outer edge and every hole edge.
</ResponseField>

<ResponseField name="offsetAtGrade" type="number" required>
  Horizontal setback from the lot line at grade, metres.
</ResponseField>

<ResponseField name="startHeight" type="number">
  Height above grade at which the plane starts leaning inward. Default 0.
</ResponseField>

<ResponseField name="slopeDeg" type="number">
  Plane slope from horizontal, degrees, in (0, 90]. Default 90 (vertical).
</ResponseField>

### ZoningViolation

```typescript theme={null}
interface ZoningViolation {
  type: ZoningViolationType;
  message: string;
  ruleId?: string;
  massId?: string;
  masses?: [string, string];
  edgeIndex?: number;
  edgeClass?: LotLineClass;
  current?: number;
  limit?: number;
}
```

### ZoningViolationType

```typescript theme={null}
type ZoningViolationType =
  | 'missing-zoning-basis'
  | 'outside-parcel'
  | 'building-collision'
  | 'building-spacing'
  | 'exceeds-far'
  | 'exceeds-lot-coverage'
  | 'exceeds-volume-ratio'
  | 'exceeds-height'
  | 'setback-violation'
  | 'front-setback-violation'
  | 'envelope-violation';
```

### ZoningMetrics

```typescript theme={null}
interface ZoningMetrics {
  siteArea: number;
  footprintArea: number;
  grossFloorArea: number;
  countedFloorArea: number;
  floorAreaRatio: number;
  siteCoverage: number;
  volumeRatio: number;
  maxHeight: number;
  perMass: Array<
    {
      id: string;
    } & MassQuantities
  >;
}
```

<ResponseField name="siteArea" type="number" required />

<ResponseField name="footprintArea" type="number" required>
  Σ ground-touching footprints.
</ResponseField>

<ResponseField name="grossFloorArea" type="number" required />

<ResponseField name="countedFloorArea" type="number" required>
  GFA of the storeys whose area kind counts toward FAR.
</ResponseField>

<ResponseField name="floorAreaRatio" type="number" required />

<ResponseField name="siteCoverage" type="number" required />

<ResponseField name="volumeRatio" type="number" required />

<ResponseField name="maxHeight" type="number" required>
  Tallest point above grade.
</ResponseField>

<ResponseField
  name="perMass"
  type="Array<{
id: string;
} & MassQuantities>"
  required
/>

## Related

* [`BuildableEnvelope`](/floorkit/api/world/zoning-envelope#buildableenvelope)
* [`LotLineClass`](/floorkit/api/world/site#lotlineclass)
* [`MassLike`](/floorkit/api/architecture/massing-helpers#masslike)
* [`MassQuantities`](/floorkit/api/architecture/building#massquantities)
* [`PolygonProfile`](/floorkit/api/primitives/polygon-maths#polygonprofile)
* [`ZoningRuleSet`](/floorkit/api/world/zoning-rules#zoningruleset)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.