---
title: Tiling
source: https://infrared.city/docs/sdk/1.0/api/typescript/tiling/
---

# Tiling

<a id="areageometrygroups"></a>

## AreaGeometryGroups

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

The geometry groups to cut into tiles.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="areageometrygroups-context-geometry"></a> `context-geometry?` | `readonly` | `Readonly`&lt;`Record`&lt;`string`, [`JsonTilingMesh`](tiling.md#jsontilingmesh)&gt;&gt; | Distant occluders for shading only. Keep them low-poly (guide: below about 50,000 triangles for the whole site). A context mesh is not cut: it goes whole into every tile job whose context box (the tile plus a border of up to 128 m, depending on the analysis) it touches, and its triangles cost upload bytes and memory once per tile. Analysed buildings and near neighbours go in `geometries`, which is cut per tile. See the README, "Bring your own geometry". |
| <a id="areageometrygroups-geometries"></a> `geometries?` | `readonly` | `Readonly`&lt;`Record`&lt;`string`, [`JsonTilingMesh`](tiling.md#jsontilingmesh)&gt;&gt; | Buildings and near neighbours to analyse; each mesh is cut per tile. |
| <a id="areageometrygroups-ground-geometry"></a> `ground-geometry?` | `readonly` | `Readonly`&lt;`Record`&lt;`string`, [`JsonTilingMesh`](tiling.md#jsontilingmesh)&gt;&gt; | Terrain meshes. Needs `terrainContext` in `ComposeOptions`. |
| <a id="areageometrygroups-ground-materials"></a> `ground-materials?` | `readonly` | `Readonly`&lt;`Record`&lt;`string`, `unknown`&gt;&gt; | Ground-material layers. |
| <a id="areageometrygroups-vegetation"></a> `vegetation?` | `readonly` | `Readonly`&lt;`Record`&lt;`string`, `unknown`&gt;&gt; | Vegetation group. |

***

<a id="cell_size_m"></a>

## CELL_SIZE_M

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

> `const` **CELL\_SIZE\_M**: `1` = `1`

Edge length of one analysis grid cell, in metres.

***

<a id="composeoptions"></a>

## ComposeOptions

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

Options for `composeTilePayloads`.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="composeoptions-analysistype"></a> `analysisType?` | `readonly` | `string` \| `null` | The analysis type, which selects the tiling parameters; unset uses the wind preset. |
| <a id="composeoptions-terraincontext"></a> `terrainContext?` | `readonly` | [`TerrainContext`](tiling.md#terraincontext) | Required when `ground-geometry` is present. |

***

<a id="composetilepayloads"></a>

## composeTilePayloads

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

> **composeTilePayloads**(`groups`, `tiles`, `polygon`, `options?`): [`TilePayloads`](tiling.md#tilepayloads)

Assigns supported geometry groups to the non-empty tiles of a grid.

Each tile's payload comes back finished: every group is already in the tile's own local
frame, with the terrain policy applied, so it can be sent as it is. Compact
`vegetation-instances` has no tiling policy yet and is rejected.

### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `groups` | [`AreaGeometryGroups`](tiling.md#areageometrygroups) | The geometry groups to cut into tiles. |
| `tiles` | readonly [`IndexedTile`](tiling.md#indexedtile)\[\] | The tiles to compose, with their grid positions. |
| `polygon` | [`Polygon`](tiling.md#polygon) | The area polygon the tiles cover. |
| `options` | [`ComposeOptions`](tiling.md#composeoptions) | The analysis type, and `terrainContext` (required with `ground-geometry`). |

### Returns

[`TilePayloads`](tiling.md#tilepayloads)

The payload of each tile, keyed by tile id.

### Throws

when a group is unknown or has no tiling policy, a mesh uses packed binary
  coordinates, `ground-geometry` is given without `terrainContext`, or a tile row or column is
  not an integer from 0 through 4,294,967,295.

***

<a id="frameorigin"></a>

## FrameOrigin

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

A frame origin as longitude and latitude in WGS84 degrees.

### Properties

| Property | Modifier | Type |
| ------ | ------ | ------ |
| <a id="frameorigin-lat"></a> `lat` | `readonly` | `number` |
| <a id="frameorigin-lon"></a> `lon` | `readonly` | `number` |

***

<a id="generatetilesforpolygon"></a>

## generateTilesForPolygon

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

> **generateTilesForPolygon**(`polygon`, `options?`): [`Tile`](tiling.md#tile)\[\]\[\]

Covers a polygon with tiles and returns the grid as `tiles[row][col]`, with row 0 at the
south and column 0 at the west.

The grid is deterministic for a polygon and analysis type, and includes tiles that do not
touch the polygon (`empty: true`); only non-empty tiles are billed jobs. A run is refused
when it would need more than 100 non-empty tiles, unless `maxTilesOverride` raises that cap.

### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `polygon` | [`Polygon`](tiling.md#polygon) | The GeoJSON `Polygon` to cover; it is validated first (see `validatePolygon`). |
| `options` | \{ `analysisType?`: `string` \| `null`; `maxTilesOverride?`: `number`; \} | - |
| `options.analysisType?` | `string` \| `null` | Selects the tile size and spacing (wind, or solar and thermal); unset uses the wind preset. |
| `options.maxTilesOverride?` | `number` | Raises the cap on non-empty tiles; an integer from 0 through 4,294,967,295. |

### Returns

[`Tile`](tiling.md#tile)\[\]\[\]

The tile grid.

### Throws

when the polygon is invalid, or when it would need too many tiles; the
  message gives the counts and the `maxTilesOverride` that would allow the run.

### Throws

when `maxTilesOverride` is not a valid integer.

***

<a id="gettilingconfig"></a>

## getTilingConfig

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

> **getTilingConfig**(`analysisType?`): [`TilingConfig`](tiling.md#tilingconfig)

Returns the tiling parameters for an analysis type.

Wind analyses (`wind-speed`, `pedestrian-wind-comfort`) and an unset or empty type use
the wind preset; any other analysis name uses the solar preset.

### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `analysisType?` | `string` \| `null` | The analysis type, or unset for the wind preset. |

### Returns

[`TilingConfig`](tiling.md#tilingconfig)

The tile size, context size, step and cell size for that family.

***

<a id="indexedtile"></a>

## IndexedTile

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

A tile with its position in the grid.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="indexedtile-col"></a> `col` | `readonly` | `number` | Column in the tile grid; column 0 is the westernmost. |
| <a id="indexedtile-row"></a> `row` | `readonly` | `number` | Row in the tile grid; row 0 is the southernmost. |
| <a id="indexedtile-tileid"></a> `tileId` | `readonly` | `string` | The identifier of the tile at this position. |

***

<a id="jsontilingmesh"></a>

## JsonTilingMesh

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

> **JsonTilingMesh** = `Readonly`&lt;`Record`&lt;`string`, `unknown`&gt;&gt; & `object`

A mesh given as flat JSON arrays of numbers: `coordinates` for the vertices and `indices`
for the triangles. Packed binary arrays (`coordinates_bin`, `indices_bin`) are not accepted
for area tiling.

### Type Declaration

| Name | Type |
| ------ | ------ |
| `coordinates?` | readonly `number`\[\] |
| `coordinates_bin?` | `never` |
| `indices?` | readonly `number`\[\] |
| `indices_bin?` | `never` |

***

<a id="point"></a>

## Point

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

A geographic point.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="point-latitude"></a> `latitude` | `readonly` | `number` | Latitude in degrees (-90 to 90). |
| <a id="point-longitude"></a> `longitude` | `readonly` | `number` | Longitude in degrees (-180 to 180). |

***

<a id="polygon"></a>

## Polygon

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

A GeoJSON `Polygon` for an area run: one ring, no holes, closed (first and last position
equal) and not self-intersecting. Positions are `[longitude, latitude]`.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="polygon-coordinates"></a> `coordinates` | `readonly` | readonly readonly [`Position`](tiling.md#position)\[\]\[\] | The rings of the polygon; an area run takes exactly one. |
| <a id="polygon-type"></a> `type` | `readonly` | `"Polygon"` | Always `"Polygon"`. |

***

<a id="position"></a>

## Position

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

> **Position** = readonly \[`number`, `number`\] \| readonly \[`number`, `number`, `number`\]

A GeoJSON position: `[longitude, latitude]` in degrees, with an optional
third value (elevation).

***

<a id="supportedareagroup"></a>

## SupportedAreaGroup

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

> **SupportedAreaGroup** = `"geometries"` \| `"context-geometry"` \| `"ground-geometry"` \| `"vegetation"` \| `"ground-materials"`

The geometry groups an area run can tile.

***

<a id="terraincontext"></a>

## TerrainContext

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

> **TerrainContext** = `object`

How far beyond a tile terrain is read: the caller's reach in metres, never less than the
analysis family's own context margin (it is a floor, not an addition to it).

### Properties

<a id="terraincontext-margin_m"></a>

#### margin\_m

> `readonly` **margin\_m**: `number`

***

<a id="tile"></a>

## Tile

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

One tile of the grid that covers an area polygon. `generateTilesForPolygon` returns them
as `Tile[row][col]`, with row 0 at the south and column 0 at the west.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="tile-centroid"></a> `centroid` | `readonly` | [`Point`](tiling.md#point) | Centre of the tile. |
| <a id="tile-empty"></a> `empty` | `readonly` | `boolean` | `true` when the tile's analysed square does not touch the polygon, so no job runs for it. |
| <a id="tile-size"></a> `size` | `readonly` | `object` | Edge lengths of the analysed square, in metres. |
| `size.x` | `readonly` | `number` | - |
| `size.y` | `readonly` | `number` | - |
| <a id="tile-tileid"></a> `tileId` | `readonly` | `string` | Identifier of the tile; it is the key of the tile in schedules and tile payloads. |

***

<a id="tile_size_cells"></a>

## TILE_SIZE_CELLS

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

> `const` **TILE\_SIZE\_CELLS**: `number`

Number of grid cells along one tile edge (`TILE_SIZE_M / CELL_SIZE_M`).

***

<a id="tile_size_m"></a>

## TILE_SIZE_M

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

> `const` **TILE\_SIZE\_M**: `512` = `512`

Edge length of one analysis tile, in metres.

***

<a id="tilepayloads"></a>

## TilePayloads

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

> **TilePayloads** = `Record`&lt;`string`, `Record`&lt;`string`, `unknown`&gt;&gt;

The payload of each tile, as `{ [tileId]: { [group]: data } }`, every group in the tile's
own local frame.

***

<a id="tiling_supported_types"></a>

## TILING_SUPPORTED_TYPES

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

> `const` **TILING\_SUPPORTED\_TYPES**: `ReadonlySet`&lt;[`AnalysesName`](requests.md#analysesname)&gt;

The analyses that can be run over a polygon area, split into tiles: every
analysis name except `daylight-factor`.

***

<a id="tilingconfig"></a>

## TilingConfig

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

The tiling parameters of an analysis family (wind, or solar and thermal), as returned by
`getTilingConfig`.

### Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
| <a id="tilingconfig-cellsizem"></a> `cellSizeM` | `readonly` | `number` | Size of one grid cell, in metres. |
| <a id="tilingconfig-contextsizem"></a> `contextSizeM` | `readonly` | `number` | Edge length of the square read for surrounding geometry, in metres. |
| <a id="tilingconfig-inferencesizecells"></a> `inferenceSizeCells` | `readonly` | `number` | Number of grid cells along one edge of a tile's result. |
| <a id="tilingconfig-inferencesizem"></a> `inferenceSizeM` | `readonly` | `number` | Edge length of the square a tile analyses, in metres. |
| <a id="tilingconfig-stepcells"></a> `stepCells` | `readonly` | `number` | `stepM` expressed in grid cells. |
| <a id="tilingconfig-stepm"></a> `stepM` | `readonly` | `number` | Distance between neighbouring tile centres, in metres. |

***

<a id="validatepolygon"></a>

## validatePolygon

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

> **validatePolygon**(`polygon`): [`Polygon`](tiling.md#polygon)

Checks a GeoJSON polygon and returns it with counter-clockwise winding.

The polygon must be a single ring with no holes, at least four positions (three distinct
vertices and the closing one), `[longitude, latitude]` positions in range, a closed ring,
no self-intersection and a non-zero area. A clockwise ring is reversed; positions are
otherwise returned as given.

### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `polygon` | [`Polygon`](tiling.md#polygon) | The GeoJSON `Polygon` to check. |

### Returns

[`Polygon`](tiling.md#polygon)

The validated polygon, wound counter-clockwise.

### Throws

when the polygon breaks any of the rules above; the message names the problem.

***
