---
title: Facade layout
source: https://infrared.city/docs/sdk/1.0/api/typescript/facade-layout/
---

# Facade layout

<a id="attachvalues"></a>

## attachValues

Import from `@infrared-city/infrared-sdk-ts`.

> **attachValues**(`layout`, `columns`, `options`): [`SurfaceColumns`](results-and-legend.md#surfacecolumns)

Checks a facade layout against a result before values are draped onto it, and refuses a
mismatch instead of placing values on plausible-looking wrong cells.

The layout's `layoutKey` must equal `options.expectedLayoutKey`. The key covers the geometry,
synthesis parameters and surface-grid and core versions, so a rebuilt layout whose geometry
drifted, even by a small hole inside a cell's footprint, has a different key and is refused
before anything else is checked. Three further checks catch a result that does not belong to
the layout: that `columns` contains each surface of the layout (joined by surface id, not by
row), that its origin, axes and grid dimensions agree with the layout's, and that exactly the
same grid cells carry a sensor, in the same row-major order. Frame keys must be unique across
the layout. Store the layout key with every result.

### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `layout` | [`FacadeLayout`](facade-layout.md#facadelayout) | The layout rebuilt for the geometry you want to check. |
| `columns` | [`SurfaceColumns`](results-and-legend.md#surfacecolumns) | The result columns (live or reloaded) to check against the layout. |
| `options` | [`AttachValuesOptions`](facade-layout.md#attachvaluesoptions) | `expectedLayoutKey`, the key stored with the result. |

### Returns

[`SurfaceColumns`](results-and-legend.md#surfacecolumns)

`columns`, unchanged; this function only verifies.

### Throws

when the layout key differs, a frame key is duplicated, a surface is missing
  from `columns`, or a surface's geometry or cell layout differs from the layout.

***

<a id="attachvaluesoptions"></a>

## AttachValuesOptions

Import from `@infrared-city/infrared-sdk-ts`, `@infrared-city/infrared-sdk-ts/tiling`.

The options of `attachValues`.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="attachvaluesoptions-expectedlayoutkey"></a> `expectedLayoutKey` | `readonly` | `string` | The `layoutKey` you stored alongside the result when it first ran. Required. It must not be read off the `layout` you are checking: a layout always agrees with its own key, so that would check nothing. |

***

<a id="facadecaptures"></a>

## FacadeCaptures

Import from `@infrared-city/infrared-sdk-ts`, `@infrared-city/infrared-sdk-ts/tiling`.

The facade captures of one client, in one capture store.

### Accessors

<a id="facadecaptures-heldbytes"></a>

#### heldBytes

##### Get Signature

> **get** **heldBytes**(): `number`

The bytes held: the distinct captures and the syntheses made from them.

###### Returns

`number`

***

<a id="facadecaptures-jobcount"></a>

#### jobCount

##### Get Signature

> **get** **jobCount**(): `number`

The number of jobs that hold a capture.

###### Returns

`number`

***

<a id="facadecaptures-store"></a>

#### store

##### Get Signature

> **get** **store**(): `any`

###### Returns

`any`

### Methods

<a id="facadecaptures-forget"></a>

#### forget()

> **forget**(`jobId`): `void`

Release a job's capture that no merge will use.

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `jobId` | `string` |

##### Returns

`void`

***

<a id="facadecaptures-forgetschedule"></a>

#### forgetSchedule()

> **forgetSchedule**(`schedule`): `void`

Release every capture of a schedule you will not merge.

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `schedule` | \{ `jobs`: `ReadonlyMap`&lt;`string`, \{ `jobId?`: `string`; \}&gt;; \} |
| `schedule.jobs` | `ReadonlyMap`&lt;`string`, \{ `jobId?`: `string`; \}&gt; |

##### Returns

`void`

***

<a id="facadecaptures-free"></a>

#### free()

> **free**(): `void`

Free the held captures. Call it when you are done with the client.

##### Returns

`void`

***

<a id="facadecaptures-lostcapture"></a>

#### lostCapture()

> **lostCapture**(`jobId`): `boolean`

Whether the capture of this accepted job was not kept (the store refused it).

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `jobId` | `string` |

##### Returns

`boolean`

***

<a id="facadecaptures-remember"></a>

#### remember()

> **remember**(`jobId`, `capture`, `cellTris`): `void`

Keep the capture of an accepted job. `cellTris`: the run asked for the per-cell triangles.

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `jobId` | `string` |
| `capture` | `Uint8Array` |
| `cellTris` | `boolean` |

##### Returns

`void`

***

<a id="facadecaptures-wantscelltris"></a>

#### wantsCellTris()

> **wantsCellTris**(`jobIds`): `boolean`

Whether any of these jobs asked for the per-cell triangles.

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `jobIds` | readonly (`string` \| `undefined`)\[\] |

##### Returns

`boolean`

***

<a id="facadelayout"></a>

## FacadeLayout

Import from `@infrared-city/infrared-sdk-ts`.

A rebuilt (or reloaded) facade or roof sensor layout.

Build one with `synthesizeFacadeLayout` or reload one with
`FacadeLayout.fromBytes`. Call `free()` when finished with it in a
long-running process, or declare it with `using`.

### Accessors

<a id="facadelayout-coreversion"></a>

#### coreVersion

##### Get Signature

> **get** **coreVersion**(): `string`

Version of the bundled geometry engine that built this layout.

###### Returns

`string`

***

<a id="facadelayout-jobs"></a>

#### jobs

##### Get Signature

> **get** **jobs**(): readonly [`FacadeLayoutJob`](facade-layout.md#facadelayoutjob)\[\]

The rebuilt layout of each job.

###### Returns

readonly [`FacadeLayoutJob`](facade-layout.md#facadelayoutjob)\[\]

***

<a id="facadelayout-layoutkey"></a>

#### layoutKey

##### Get Signature

> **get** **layoutKey**(): `string`

Identifier of this layout. Store it with your results and check it on reload.

###### Returns

`string`

***

<a id="facadelayout-surfgridversion"></a>

#### surfgridVersion

##### Get Signature

> **get** **surfgridVersion**(): `number`

The sensor-layout version this layout was built at.

###### Returns

`number`

***

<a id="facadelayout-synthparams"></a>

#### synthParams

##### Get Signature

> **get** **synthParams**(): [`FacadeLayoutSynthParams`](facade-layout.md#facadelayoutsynthparams)

The sensor settings this layout was built with.

###### Returns

[`FacadeLayoutSynthParams`](facade-layout.md#facadelayoutsynthparams)

### Methods

<a id="facadelayout-_surfacerenderbuffers"></a>

#### \_surfaceRenderBuffers()

> **\_surfaceRenderBuffers**(`columns`): `unknown`

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `columns` | [`SurfaceColumns`](results-and-legend.md#surfacecolumns) |

##### Returns

`unknown`

***

<a id="facadelayout-dispose"></a>

#### \[dispose\]()

> **\[dispose\]**(): `void`

Lets `using layout = synthesizeFacadeLayout(...)` call `free()` at the end of its scope.

##### Returns

`void`

***

<a id="facadelayout-free"></a>

#### free()

> **free**(): `void`

Release the memory this layout holds. Safe to call more than once. Every other member keeps
working after `free()`, except `toBytes()`: call it before `free()`, unless its result was
already cached by an earlier `toBytes()` call.

`jobs` also keeps returning correct data after `free()`: its arrays are copied out of the
held memory once, at that moment. Arrays you already took from an earlier read of `jobs`
are independent and unaffected.

##### Returns

`void`

***

<a id="facadelayout-tobytes"></a>

#### toBytes()

> **toBytes**(): `Uint8Array`

The compact export of this layout: no full-cell triangles, compressed. It never rebuilds
the layout, and is computed once and cached.

##### Returns

`Uint8Array`

The bytes to store and reload with `FacadeLayout.fromBytes`.

##### Throws

when the layout was already freed and its bytes were never cached.

***

<a id="facadelayout-frombytes"></a>

#### fromBytes()

> `static` **fromBytes**(`bytes`, `options?`): `FacadeLayout`

Load a layout from the format `FacadeLayout.toBytes` produces.

##### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `bytes` | `Uint8Array` | The bytes returned by `toBytes()`. |
| `options?` | \{ `schedule?`: [`AreaSchedule`](run-an-analysis.md#areaschedule); \} | Pass `schedule`, the saved tiled run, when the bytes were exported from a layout built from a `schedule`; the reloaded layout is then shifted into the site frame exactly as the original was. |
| `options.schedule?` | [`AreaSchedule`](run-an-analysis.md#areaschedule) | - |

##### Returns

`FacadeLayout`

The reloaded layout.

***

<a id="facadelayoutframe"></a>

## FacadeLayoutFrame

Import from `@infrared-city/infrared-sdk-ts`.

One coplanar surface region and its sensor cells, in canonical cell order
(`cells[i * nu + j]`).

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="facadelayoutframe-cells"></a> `cells` | `readonly` | readonly (`number` \| `null`)\[\] | Per-cell index into this job's flat sensor arrays, `null` outside the surface. |
| <a id="facadelayoutframe-gridsize"></a> `gridSize` | `readonly` | `number` | Edge length of one cell. |
| <a id="facadelayoutframe-key"></a> `key` | `readonly` | `string` | Identifier of this surface region. |
| <a id="facadelayoutframe-nu"></a> `nu` | `readonly` | `number` | Number of cells along `uAxis`. |
| <a id="facadelayoutframe-nv"></a> `nv` | `readonly` | `number` | Number of cells along `vAxis`. |
| <a id="facadelayoutframe-origin"></a> `origin` | `readonly` | readonly \[`number`, `number`, `number`\] | Position of the grid origin, as x, y, z. |
| <a id="facadelayoutframe-uaxis"></a> `uAxis` | `readonly` | readonly \[`number`, `number`, `number`\] | Direction of the grid's first axis (cell index `j`). |
| <a id="facadelayoutframe-vaxis"></a> `vAxis` | `readonly` | readonly \[`number`, `number`, `number`\] | Direction of the grid's second axis (cell index `i`). |

***

<a id="facadelayoutjob"></a>

## FacadeLayoutJob

Import from `@infrared-city/infrared-sdk-ts`.

One job's rebuilt sensor layout.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="facadelayoutjob-cellarea"></a> `cellArea?` | `readonly` | `Float32Array`&lt;`ArrayBufferLike`&gt; | Area of each sensor's cell, one value per sensor, when available. |
| <a id="facadelayoutjob-celltris"></a> `cellTris?` | `readonly` | `Float32Array`&lt;`ArrayBufferLike`&gt; | Flat triangle floats (9 per triangle), `undefined` without triangles. |
| <a id="facadelayoutjob-celltrisoffsets"></a> `cellTrisOffsets?` | `readonly` | `Uint32Array`&lt;`ArrayBufferLike`&gt; | `sensorCount + 1`: sensor `s` owns `cellTris[cellTrisOffsets[s]..cellTrisOffsets[s+1]]`. |
| <a id="facadelayoutjob-culledbelowterrain"></a> `culledBelowTerrain` | `readonly` | `number` | Number of sensors dropped for lying below the terrain. |
| <a id="facadelayoutjob-entityhashes"></a> `entityHashes` | `readonly` | readonly `string`\[\] | Content hashes of the buildings that went into this job's layout. |
| <a id="facadelayoutjob-frames"></a> `frames` | `readonly` | readonly [`FacadeLayoutFrame`](facade-layout.md#facadelayoutframe)\[\] | The coplanar surface regions the sensors were laid out on. |
| <a id="facadelayoutjob-hasterrain"></a> `hasTerrain` | `readonly` | `boolean` | Whether the layout was built against terrain. |
| <a id="facadelayoutjob-jobid"></a> `jobId` | `readonly` | `string` | Identifier of the job. |
| <a id="facadelayoutjob-normals"></a> `normals` | `readonly` | `Float64Array` | Interleaved surface normals (x, y, z), one triple per sensor. |
| <a id="facadelayoutjob-points"></a> `points` | `readonly` | `Float64Array` | Interleaved xyz, one triple per sensor. |
| <a id="facadelayoutjob-sensorlayouthash"></a> `sensorLayoutHash` | `readonly` | `string` | Identical to the server's hash for the same inputs and settings. |
| <a id="facadelayoutjob-warnings"></a> `warnings` | `readonly` | readonly `string`\[\] | Warnings raised while building the layout. |

***

<a id="facadelayoutjobspec"></a>

## FacadeLayoutJobSpec

Import from `@infrared-city/infrared-sdk-ts`.

One job to rebuild a layout for, as named in `SynthesizeFacadeLayoutInput.jobs`.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="facadelayoutjobspec-activeids"></a> `activeIds?` | `readonly` | readonly `string`\[\] | Ids of the buildings this job covers. Omit for every building. |
| <a id="facadelayoutjobspec-jobid"></a> `jobId` | `readonly` | `string` | Identifier of the job, as it appears on the rebuilt `FacadeLayoutJob`. |
| <a id="facadelayoutjobspec-tileorigin"></a> `tileOrigin?` | `readonly` | [`FrameOrigin`](tiling.md#frameorigin) | The reference point (longitude and latitude) of the tile this job ran for, so the layout is rebuilt in that tile's own frame. Required alongside `SynthesizeFacadeLayoutInput.siteOrigin`; omit both for an untiled run. |

***

<a id="facadelayoutmesh"></a>

## FacadeLayoutMesh

Import from `@infrared-city/infrared-sdk-ts`.

A triangle mesh as the `geometries` and `ground` documents carry it. Typed arrays are
accepted as they are.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="facadelayoutmesh-coordinates"></a> `coordinates` | `readonly` | `ArrayLike`&lt;`number`&gt; | Flat vertex coordinates: x, y, z for each vertex. |
| <a id="facadelayoutmesh-indices"></a> `indices` | `readonly` | `ArrayLike`&lt;`number`&gt; | Flat triangle vertex indices: three per triangle. |

***

<a id="facadelayoutsynthparams"></a>

## FacadeLayoutSynthParams

Import from `@infrared-city/infrared-sdk-ts`.

The sensor settings a layout was built with, echoed back.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="facadelayoutsynthparams-emitcelltris"></a> `emitCellTris` | `readonly` | `boolean` | Whether the layout keeps the clipped triangles of every cell. |
| <a id="facadelayoutsynthparams-gridsize"></a> `gridSize` | `readonly` | `number` | Sensor grid size, in metres. |
| <a id="facadelayoutsynthparams-maxsensors"></a> `maxSensors` | `readonly` | `number` | Maximum number of sensors in one job. |
| <a id="facadelayoutsynthparams-meshcleaning"></a> `meshCleaning` | `readonly` | `"auto"` \| `"off"` | The mesh cleaning mode used. |
| <a id="facadelayoutsynthparams-mincoverage"></a> `minCoverage` | `readonly` | `number` | Minimum covered fraction a partial cell needed. |
| <a id="facadelayoutsynthparams-mode"></a> `mode` | `readonly` | `"facades"` \| `"roofs"` \| `"all"` | Which surfaces carry sensors. |
| <a id="facadelayoutsynthparams-offset"></a> `offset` | `readonly` | `number` | Offset of the sensors from the surface, in metres. |
| <a id="facadelayoutsynthparams-partialcells"></a> `partialCells` | `readonly` | `boolean` | Whether partly covered cells got sensors. |

***

<a id="synthesizefacadelayout"></a>

## synthesizeFacadeLayout

Import from `@infrared-city/infrared-sdk-ts`.

> **synthesizeFacadeLayout**(`input`): [`FacadeLayout`](facade-layout.md#facadelayout)

Rebuild a facade or roof sensor layout offline from the original inputs. It makes no network
request and costs nothing. It does not compute the export bytes; call `FacadeLayout.toBytes`.

### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `input` | [`SynthesizeFacadeLayoutInput`](facade-layout.md#synthesizefacadelayoutinput) | The original scene and sensor settings of the run. |

### Returns

[`FacadeLayout`](facade-layout.md#facadelayout)

The rebuilt layout.

### Throws

when `schedule` is passed together with `siteOrigin` or
`jobs`, or when the requested layout version cannot be built.

***

<a id="synthesizefacadelayoutinput"></a>

## SynthesizeFacadeLayoutInput

Import from `@infrared-city/infrared-sdk-ts`.

The input to `synthesizeFacadeLayout`: the original scene and the sensor
settings of the facade or roof run to rebuild.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="synthesizefacadelayoutinput-analysissurfaces"></a> `analysisSurfaces` | `readonly` | `"facades"` \| `"roofs"` \| `"all"` | Which surfaces carry sensors: `"facades"`, `"roofs"` or `"all"`. |
| <a id="synthesizefacadelayoutinput-buildings"></a> `buildings` | `readonly` | `Readonly`&lt;`Record`&lt;`string`, [`FacadeLayoutMesh`](facade-layout.md#facadelayoutmesh)&gt;&gt; | The buildings of the run, by id. |
| <a id="synthesizefacadelayoutinput-emitcelltris"></a> `emitCellTris?` | `readonly` | `boolean` | Whether the layout keeps the clipped triangles of every cell (`FacadeLayoutJob.cellTris`). Default `false`. Set `true` only to draw the old per-cell mesh or to export the geometry of each cell. Do not set it to draw with `surfaceRenderBuffers`: that needs only the frames, the cells and the outline, which every layout holds. The triangles make the layout about three times larger. Sensors and hashes do not change. |
| <a id="synthesizefacadelayoutinput-ground"></a> `ground?` | `readonly` | `Readonly`&lt;`Record`&lt;`string`, [`FacadeLayoutMesh`](facade-layout.md#facadelayoutmesh)&gt;&gt; | Ground meshes of the run, by id. Omit when the run had none. |
| <a id="synthesizefacadelayoutinput-jobs"></a> `jobs?` | `readonly` | readonly [`FacadeLayoutJobSpec`](facade-layout.md#facadelayoutjobspec)\[\] | Reproduce a saved run's job split. Omit for one job over every building. |
| <a id="synthesizefacadelayoutinput-maxsensorsperjob"></a> `maxSensorsPerJob?` | `readonly` | `number` | Maximum number of sensors in one job. Default 262144. |
| <a id="synthesizefacadelayoutinput-meshcleaning"></a> `meshCleaning?` | `readonly` | `"auto"` \| `"off"` | Mesh cleaning before synthesis: `"auto"` (default) or `"off"`. |
| <a id="synthesizefacadelayoutinput-mincoverage"></a> `minCoverage?` | `readonly` | `number` | Minimum covered fraction a partial cell needs to keep a sensor. Default 0.05. |
| <a id="synthesizefacadelayoutinput-partialcells"></a> `partialCells?` | `readonly` | `boolean` | Whether cells partly covered by a surface get sensors. Default `true`. |
| <a id="synthesizefacadelayoutinput-schedule"></a> `schedule?` | `readonly` | [`AreaSchedule`](run-an-analysis.md#areaschedule) | The `AreaSchedule` of a tiled `runArea()` call; derives `siteOrigin` and `jobs` from it. Mutually exclusive with passing either explicitly. |
| <a id="synthesizefacadelayoutinput-siteorigin"></a> `siteOrigin?` | `readonly` | [`FrameOrigin`](tiling.md#frameorigin) | The reference point (longitude and latitude) that the coordinates of `buildings` and `ground` are expressed around. Required alongside a job's `tileOrigin`. |
| <a id="synthesizefacadelayoutinput-surfacegridsize"></a> `surfaceGridSize` | `readonly` | `number` | The sensor grid size of the run, in metres. |
| <a id="synthesizefacadelayoutinput-surfaceoffset"></a> `surfaceOffset?` | `readonly` | `number` | Offset of the sensors from the surface, in metres. Default 0.1 (as a live run); set only to rebuild a layout that used another value. |
| <a id="synthesizefacadelayoutinput-surfgridversion"></a> `surfgridVersion?` | `readonly` | `number` | The sensor-layout version to rebuild at. Omit for the bundled engine's current version, echoed back on `FacadeLayout.surfgridVersion`. A version that cannot be built is refused, never mapped to the nearest one. |
| <a id="synthesizefacadelayoutinput-terrainalignment"></a> `terrainAlignment?` | `readonly` | `string` | The terrain alignment setting of the run, passed as the run used it. |

***
