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

# Interface: SpatialQuery<TableInfo>

> A spatial set read.

[server](/api/modules/server).SpatialQuery

A spatial set read. Pagination batches have private native order;
nearest establishes a global reported-point distance order. A physical
encoding never defines a logical top-N result.

## Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

## Hierarchy

* `AsyncIterable`\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>>

  ↳ **`SpatialQuery`**

## Methods

### where

▸ **where**(`predicate`): [`SpatialQuery`](/api/interfaces/server.SpatialQuery)\<`TableInfo`>

#### Parameters

| Name | Type |
| :- | :- |
| `predicate` | (`row`: [`SpatialRow`](/api/modules/server#spatialrow)\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>>) => [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`boolean`> |

#### Returns

[`SpatialQuery`](/api/interfaces/server.SpatialQuery)\<`TableInfo`>

***

### filter

▸ **filter**(`predicate`): [`SpatialQuery`](/api/interfaces/server.SpatialQuery)\<`TableInfo`>

#### Parameters

| Name | Type |
| :- | :- |
| `predicate` | (`q`: [`FilterBuilder`](/api/interfaces/server.FilterBuilder)\<`TableInfo`>) => [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`boolean`> |

#### Returns

[`SpatialQuery`](/api/interfaces/server.SpatialQuery)\<`TableInfo`>

***

### collect

▸ **collect**(): `Promise`\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>\[]>

#### Returns

`Promise`\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>\[]>

***

### paginate

▸ **paginate**(`options`): `Promise`\<[`PaginationResult`](/api/interfaces/server.PaginationResult)\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>>>

#### Parameters

| Name | Type |
| :- | :- |
| `options` | [`PaginationOptions`](/api/interfaces/server.PaginationOptions) |

#### Returns

`Promise`\<[`PaginationResult`](/api/interfaces/server.PaginationResult)\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>>>

***

### readPage

▸ **readPage**(`options`): `Promise`\<[`QueryReadPage`](/api/modules/server#queryreadpage)\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>>>

#### Parameters

| Name | Type |
| :- | :- |
| `options` | [`PaginationOptions`](/api/interfaces/server.PaginationOptions) |

#### Returns

`Promise`\<[`QueryReadPage`](/api/modules/server#queryreadpage)\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>>>

***

### nearest

▸ **nearest**(`origin`, `options`): `Promise`\<\{ `doc`: [`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`> ; `distance_m`: `number`  }\[]>

Order by reported point distance. Refuse if global ordering cannot be
established within the native work budget. Requires a spatial index.

#### Parameters

| Name | Type |
| :- | :- |
| `origin` | [`Point`](/api/modules/values#point) |
| `options` | `Object` |
| `options.limit` | `number` |
| `options.max_distance_m?` | `number` |

#### Returns

`Promise`\<\{ `doc`: [`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`> ; `distance_m`: `number`  }\[]>

***

### \[asyncIterator]

▸ **\[asyncIterator]**(): `AsyncIterator`\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>, `any`, `undefined`>

#### Returns

`AsyncIterator`\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<`TableInfo`>, `any`, `undefined`>

#### Inherited from

AsyncIterable.\[asyncIterator]


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