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

# The roof format

> How to describe a roof for an ESX export: the plan, structures, points, edges, faces, heights and features of osa-roof/1.

An ESX export's `input` is a roof in OSA's roof format, version 1 (`osa-roof/1`). It describes one or more roofs as seen from above, with enough to build each one in three dimensions: where the corners are, what each edge is, how steep each face is, and, where known, how high the eaves are.

You are responsible for the roof being right. OSA checks only that it holds together: a roof that cannot be built is refused, and any other problem is a warning. See [Roof checks and problems](https://docs.osaconnection.com/roof-checks.md).

Lengths and areas are not sent: OSA works them out from the points and the faces' pitches.

## A complete example

A simple gable, 40 by 30 ft, pitch 6/12, with its eaves 9 ft above the ground, drawn in feet:

```json theme={"system"}
{
  "type": "roof",
  "format": "osa-roof/1",
  "plan": { "units": "ft", "y_axis": "up", "north_deg": 0 },
  "structures": [
    {
      "id": "house",
      "points": [
        { "id": "a", "x": -20, "y": -15 },
        { "id": "b", "x": 20, "y": -15 },
        { "id": "c", "x": 20, "y": 15 },
        { "id": "d", "x": -20, "y": 15 },
        { "id": "e", "x": -20, "y": 0 },
        { "id": "f", "x": 20, "y": 0 }
      ],
      "edges": [
        { "id": "eave-s", "from": "a", "to": "b", "type": "eave" },
        { "id": "eave-n", "from": "c", "to": "d", "type": "eave" },
        { "id": "ridge", "from": "e", "to": "f", "type": "ridge" },
        { "id": "rake-sw", "from": "a", "to": "e", "type": "rake" },
        { "id": "rake-se", "from": "b", "to": "f", "type": "rake" },
        { "id": "rake-ne", "from": "c", "to": "f", "type": "rake" },
        { "id": "rake-nw", "from": "d", "to": "e", "type": "rake" }
      ],
      "faces": [
        { "id": "south", "edges": ["eave-s", "rake-se", "ridge", "rake-sw"], "pitch": 6, "eave_height_ft": 9 },
        { "id": "north", "edges": ["eave-n", "rake-nw", "ridge", "rake-ne"], "pitch": 6, "eave_height_ft": 9 }
      ]
    }
  ]
}
```

The four corners `a` to `d` are the eaves' ends, and `e` and `f` are the ridge's. Two eaves, a ridge and four rakes bound two faces, each sloping down toward its eave. [ESX exports](https://docs.osaconnection.com/esx-exports.md#send-a-roof) shows the whole request this goes into.

`type`, `format`, `plan` and `structures` are required. `type` is always `roof` and `format` always `osa-roof/1`.

## What you draw

* **The roof as seen from above.** Each point is a corner of the roof, and `x` and `y` are its position on the drawing. [`plan`](#the-plan) says which way `y` grows and which way the top of the drawing faces.
* **Eave heights from the ground.** `eave_height_ft` is the height above the ground of the face's eave edges.
* **Pitches up to 24/12.** A face's `pitch` is at most 24.
* **What the format does not cover:** roof material, chimneys, photos, line items, holes in faces, and where the measurements came from.

## Ids

Every point, edge, face and structure has an `id` of 1 to 64 letters, digits, `-`, `_` or `.`, unique within its list. Use your own: problems name them, so you can find what each one is about.

## The plan

`plan` says how to read every `x` and `y`.

| Field | Required | Meaning |
| - | - | - |
| `units` | Yes | `ft`: `x` and `y` are feet. `px`: `x` and `y` are pixels of an image, and `feet_per_pixel` is required |
| `feet_per_pixel` | When `units` is `px` | Horizontal (plan) feet per pixel, one scale for the whole plan. More than 0, at most 10. Not allowed with `ft` |
| `y_axis` | Yes | `up`: `y` grows upward on the drawing, as on a map. `down`: `y` grows downward, as in an image |
| `north_deg` | No | The compass direction the top of the drawing faces, in degrees clockwise from north, from 0 to less than 360. Leave it out for 0: the top of the drawing is north, as in most aerial imagery |

Heights are always in feet, whatever the plan's units. Fields that carry a height end in `_ft`.

The origin can be anywhere: OSA moves it to the middle of each structure.

## Structures

`structures` lists the separate buildings, such as a house and a detached garage, at most 10. Each is a roof that touches no other structure's roof. Most roofs have one.

| Field | Required | Meaning |
| - | - | - |
| `id` | Yes | Your name for the structure, unique in the roof |
| `name` | No | A label, such as "Detached garage", up to 100 characters |
| `points` | Yes | Every corner of the roof, 3 to 1,000 |
| `edges` | Yes | Every line between two points that bounds a face, 3 to 2,000 |
| `faces` | Yes | Every flat surface of the roof, 1 to 300 |
| `features` | No | Counts of things on the roof. See [Features](#features) |

## Points

Each corner of the roof as seen from above.

| Field | Required | Meaning |
| - | - | - |
| `id` | Yes | Unique in the structure |
| `x`, `y` | Yes | Position, in the plan's units |
| `z_ft` | No | Height above the ground, in feet, from -50 to 300. Either every point in the structure has one or none does. See [Heights](#heights) |

**A point is one place in three dimensions.** Where two parts of a roof pass over the same spot at different heights, such as a lower roof meeting the wall below a higher eave, that spot needs two points: one for each roof. The [example with two levels](#a-roof-with-two-levels) below does this.

## Edges

Each line between two points that bounds a face.

| Field | Required | Meaning |
| - | - | - |
| `id` | Yes | Unique in the structure |
| `from`, `to` | Yes | The ids of the edge's two points, which must differ. Order does not matter |
| `type` | Yes | What the edge is (below) |
| `overhang_ft` | No | How far the roof overhangs the wall, in feet, from 0 to 10. Only on an `eave` or a `rake`; on any other edge the roof is refused (check 1) |

| `type` | Meaning |
| - | - |
| `eave` | The low, level edge of a face, where water runs off |
| `rake` | The sloped outer edge at a gable end |
| `ridge` | Where two faces meet at the top |
| `hip` | Where two faces meet at an outward corner, sloping down |
| `valley` | Where two faces meet at an inward corner, sloping down |
| `apron_flashing` | Where the top of a face meets a wall that rises above it (also called headwall) |
| `step_flashing` | Where the side of a face runs along a wall that rises beside it (also called sidewall) |
| `pitch_break` | Where a face changes pitch without a ridge, as on a gambrel or mansard roof |
| `unclassified` | An edge whose kind is not known. Allowed, but it adds nothing to the estimate |

## Faces

Each flat surface of the roof.

| Field | Required | Meaning |
| - | - | - |
| `id` | Yes | Unique in the structure |
| `edges` | Yes | The ids of the edges around the face, in order around it, 3 to 200. Each consecutive pair shares a point and the last joins the first |
| `pitch` | Yes | Rise in inches per 12 inches of run, as a number: `6` for 6/12, `6.5` for 6.5/12, `0` for flat. At most 24 |
| `eave_height_ft` | No | Height above the ground of the face's eave edges, in feet, from -50 to 300. See [Heights](#heights) |
| `low_edge` | No | The id of the edge the face slopes down toward. Send it when the face has no `eave` edge and a pitch above 0 |

### Which way a face slopes

A face slopes down toward its `eave` edges, at right angles to them. All of a face's eaves should be parallel and on the same side of it. A face with eaves on opposite sides is built sloping toward its longest group of eaves, with a warning.

An `eave` edge can also be where a lower roof ties in: the same edge is the low edge of the upper face and the top edge of the lower one. So a face's eaves are its `eave` edges that lie on no other face. Only if a face has no such edge are its `eave` edges shared with another face used as its eaves.

A sloped face with no eave, such as the upper face of a gambrel above its `pitch_break`, names the edge it slopes down toward in `low_edge`. Without it, the face is built from the faces around it, with a major warning. A flat face (pitch 0) needs neither.

### Flat means flat

Every point of a face should lie on one plane: the plane its pitch, slope direction and height give it. Where faces share a point, they should agree on its height to within 1 inch. Beyond that, the point is built at their average, with a warning. With `z_ft` on every point, nothing is averaged: see [Heights](#heights).

## Heights

Give heights one way per structure. A structure that uses both `z_ft` and `eave_height_ft` is refused (check 1).

1. **No heights at all.** The roof is built with its lowest eave at 0 ft. The ESX has a correctly shaped roof but no height above the ground.
2. **`eave_height_ft` on faces** (recommended). Faces that share a ridge, hip or valley take their heights from each other, so one face per section of roof is enough. A roof with several eave levels, such as a second storey over a garage, gives each level its own eave height.
3. **`z_ft` on every point**, if you measure in three dimensions. Each point is built at the height you gave it, and nothing is averaged. OSA checks that every face is flat and that its pitch matches its points; where one does not, a check 5 warning says so: `minor` up to 1 ft, `major` beyond.

A **section** is a group of faces that share points. A lower roof that meets the wall of a higher one has its own points there, so it is a section of its own: it cannot take its height from the roof above. In a structure that gives heights, a section left without one is built with its lowest eave at 0 ft, with a major warning.

A structure with `z_ft` on some points but not all is refused (check 1). See [Roof checks and problems](https://docs.osaconnection.com/roof-checks.md#critical-problems).

### A roof with two levels

A two-storey gable with a lower roof on its south side. The lower roof meets the wall under the upper south eave, so the points where they meet are drawn twice: `up-sw` and `up-se` for the upper eave, `wall-w` and `wall-e` for the top of the lower roof, at the same `x` and `y`. Each level gives its own eave height.

```json theme={"system"}
{
  "type": "roof",
  "format": "osa-roof/1",
  "plan": { "units": "ft", "y_axis": "up", "north_deg": 0 },
  "structures": [
    {
      "id": "house",
      "name": "Two-storey gable with a lower roof on the south side",
      "points": [
        { "id": "up-sw", "x": -15, "y": 0 },
        { "id": "up-se", "x": 15, "y": 0 },
        { "id": "up-ne", "x": 15, "y": 20 },
        { "id": "up-nw", "x": -15, "y": 20 },
        { "id": "ridge-w", "x": -15, "y": 10 },
        { "id": "ridge-e", "x": 15, "y": 10 },
        { "id": "low-sw", "x": -15, "y": -12 },
        { "id": "low-se", "x": 15, "y": -12 },
        { "id": "wall-e", "x": 15, "y": 0 },
        { "id": "wall-w", "x": -15, "y": 0 }
      ],
      "edges": [
        { "id": "eave-s", "from": "up-sw", "to": "up-se", "type": "eave" },
        { "id": "rake-se", "from": "up-se", "to": "ridge-e", "type": "rake" },
        { "id": "ridge", "from": "ridge-e", "to": "ridge-w", "type": "ridge" },
        { "id": "rake-sw", "from": "ridge-w", "to": "up-sw", "type": "rake" },
        { "id": "eave-n", "from": "up-ne", "to": "up-nw", "type": "eave" },
        { "id": "rake-nw", "from": "up-nw", "to": "ridge-w", "type": "rake" },
        { "id": "rake-ne", "from": "ridge-e", "to": "up-ne", "type": "rake" },
        { "id": "low-eave", "from": "low-sw", "to": "low-se", "type": "eave" },
        { "id": "low-rake-e", "from": "low-se", "to": "wall-e", "type": "rake" },
        { "id": "headwall", "from": "wall-e", "to": "wall-w", "type": "apron_flashing" },
        { "id": "low-rake-w", "from": "wall-w", "to": "low-sw", "type": "rake" }
      ],
      "faces": [
        { "id": "upper-south", "edges": ["eave-s", "rake-se", "ridge", "rake-sw"], "pitch": 6, "eave_height_ft": 18 },
        { "id": "upper-north", "edges": ["eave-n", "rake-nw", "ridge", "rake-ne"], "pitch": 6, "eave_height_ft": 18 },
        { "id": "lower", "edges": ["low-eave", "low-rake-e", "headwall", "low-rake-w"], "pitch": 4, "eave_height_ft": 9 }
      ]
    }
  ]
}
```

## Features

`features` counts things on a structure's roof that the estimate needs and the drawing does not show. Each is a whole number from 1 to 100,000; leave out what is not there. They apply to the structure's whole roof, not to one face.

| Field | Meaning |
| - | - |
| `pipe_jack_vents` | Plumbing vent pipes |
| `exhaust_vents` | Exhaust vents |
| `attic_vents` | Attic vents |
| `reflective_tubes` | Tubular skylights |
| `satellite_dishes` | Satellite dishes |
| `ac_units` | Air conditioning units on the roof |
| `skylights` | Skylights |
| `roofing_panels` | Roofing panels |
| `gutter_ft` | Gutter, in whole feet |

### A house and a garage

Two structures: a hip-roofed house with features and an overhang on every eave, and a detached gable garage. Only the house's south face carries an eave height; the other three faces take theirs from it through the hips and the ridge.

```json theme={"system"}
{
  "type": "roof",
  "format": "osa-roof/1",
  "plan": { "units": "ft", "y_axis": "up", "north_deg": 0 },
  "structures": [
    {
      "id": "house",
      "name": "House, hip roof",
      "points": [
        { "id": "sw", "x": -20, "y": -15 },
        { "id": "se", "x": 20, "y": -15 },
        { "id": "ne", "x": 20, "y": 15 },
        { "id": "nw", "x": -20, "y": 15 },
        { "id": "ridge-w", "x": -5, "y": 0 },
        { "id": "ridge-e", "x": 5, "y": 0 }
      ],
      "edges": [
        { "id": "eave-s", "from": "sw", "to": "se", "type": "eave", "overhang_ft": 1.5 },
        { "id": "eave-e", "from": "se", "to": "ne", "type": "eave", "overhang_ft": 1.5 },
        { "id": "eave-n", "from": "ne", "to": "nw", "type": "eave", "overhang_ft": 1.5 },
        { "id": "eave-w", "from": "nw", "to": "sw", "type": "eave", "overhang_ft": 1.5 },
        { "id": "hip-sw", "from": "sw", "to": "ridge-w", "type": "hip" },
        { "id": "hip-se", "from": "se", "to": "ridge-e", "type": "hip" },
        { "id": "hip-ne", "from": "ne", "to": "ridge-e", "type": "hip" },
        { "id": "hip-nw", "from": "nw", "to": "ridge-w", "type": "hip" },
        { "id": "ridge", "from": "ridge-w", "to": "ridge-e", "type": "ridge" }
      ],
      "faces": [
        { "id": "south", "edges": ["eave-s", "hip-se", "ridge", "hip-sw"], "pitch": 6, "eave_height_ft": 9 },
        { "id": "east", "edges": ["eave-e", "hip-ne", "hip-se"], "pitch": 6 },
        { "id": "north", "edges": ["eave-n", "hip-nw", "ridge", "hip-ne"], "pitch": 6 },
        { "id": "west", "edges": ["eave-w", "hip-sw", "hip-nw"], "pitch": 6 }
      ],
      "features": { "pipe_jack_vents": 3, "exhaust_vents": 1, "attic_vents": 4, "skylights": 2, "gutter_ft": 140 }
    },
    {
      "id": "garage",
      "name": "Detached garage",
      "points": [
        { "id": "sw", "x": 35, "y": -12 },
        { "id": "se", "x": 55, "y": -12 },
        { "id": "ne", "x": 55, "y": 12 },
        { "id": "nw", "x": 35, "y": 12 },
        { "id": "ridge-w", "x": 35, "y": 0 },
        { "id": "ridge-e", "x": 55, "y": 0 }
      ],
      "edges": [
        { "id": "eave-s", "from": "sw", "to": "se", "type": "eave" },
        { "id": "eave-n", "from": "ne", "to": "nw", "type": "eave" },
        { "id": "ridge", "from": "ridge-w", "to": "ridge-e", "type": "ridge" },
        { "id": "rake-sw", "from": "sw", "to": "ridge-w", "type": "rake" },
        { "id": "rake-se", "from": "se", "to": "ridge-e", "type": "rake" },
        { "id": "rake-ne", "from": "ne", "to": "ridge-e", "type": "rake" },
        { "id": "rake-nw", "from": "nw", "to": "ridge-w", "type": "rake" }
      ],
      "faces": [
        { "id": "south", "edges": ["eave-s", "rake-se", "ridge", "rake-sw"], "pitch": 4, "eave_height_ft": 8 },
        { "id": "north", "edges": ["eave-n", "rake-nw", "ridge", "rake-ne"], "pitch": 4, "eave_height_ft": 8 }
      ]
    }
  ]
}
```

Ids are unique within their own list, so the house and the garage can both have a point `sw`.


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