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 | {}>;
Parameters
Parameter | Type | Description |
|---|---|---|
tileKey | TileKey | The tile key of the tile. |
abortSignal | AbortSignal | undefined | (Optional) |
Returns:
Promise<ArrayBufferLike \| {}>
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) {
// a network error happened
console.error("Unable to download tile", response.statusText);
return;
}
// the response is ok and contains data, access it e.g. as arrayBuffer:
const payload = await response.arrayBuffer();