Skip to main content

flywave-vectortile-datasource.omvrestclient.gettile

Home > @flywave/flywave-vectortile-datasource > OmvRestClient > getTile

OmvRestClient.getTile() method

Asynchronously fetches a tile from this restful server.

Signature:

getTile(tileKey: TileKey, abortSignal?: AbortSignal | undefined): Promise<ArrayBufferLike | &#123;&#125;>;

Parameters

Parameter

Type

Description

tileKey

TileKey

The tile key of the tile.

abortSignal

AbortSignal | undefined

(Optional)

Returns:



Promise&lt;ArrayBufferLike \| &#123;&#125;&gt;

A `Promise` of the HTTP response that contains the payload of the requested tile.

## Remarks

\*\*Note:\*\* In case of an HTTP Error, rejected promise is returned with an error.

## Example


```typescript
const response = layer.getTile(tileKey);
if (!response.ok) &#123;
// a network error happened
console.error("Unable to download tile", response.statusText);
return;
&#125;

// the response is ok and contains data, access it e.g. as arrayBuffer:
const payload = await response.arrayBuffer();