---
title: "Map layers and weather"
section: "Third party keys"
route: /thirdpartykeysmaplayers
account: {accountId}
bruce_api: https://{accountId}.api.nextspace.host
guardian_api: https://guardian.nextspace.host
---
# Map layers and weather

Several of the default base maps a Project View can show, and the weather layers in Navigator, come from external tile services that need a key. Each service has its own program ID.

In Operator these are the "Bing Maps", "Mapbox", "Stadia Maps", "Thunderforest" and "OpenWeather" fields of the Third Party Keys panel. You can read about the record and its requests in [Third party keys](/thirdpartykeys).

## Base maps

Each default base map has a tileset ID, which is what a Project View stores. The table lists which key each one needs.

| Base map tileset IDs | Web Navigator | Unreal Navigator |
| --- | --- | --- |
| "bingmapsaerial", "bingmapsaerialwithlabels", "bingmapsroads" | "CesiumIon". The "BingMaps" key is only read when the CesiumJS build cannot load imagery from Cesium Ion. | "CesiumIon". |
| "mapboxsatellite", "mapboxstreets", "mapboxstreetsclassic" | "Mapbox". | "CesiumIon". These are drawn with the nearest Bing Maps equivalent. |
| "stamenwatercolor", "stamentoner" | "StadiaMaps". | "StadiaMaps". |
| "thunderforestcycle", "thunderforesttransport", "thunderforestlandscape" | "Thunderforest". | "Thunderforest". |
| "esriworldimagery", "esriworldstreetmap", "esrinationalgeographic", "openstreetmap", "linz", "grid" | No key. | No key. |

An external map Tileset with the "mapType" "MapBoxImagery" can carry its own key in its "key" setting. When it does not, the web Navigator uses the account's "Mapbox" key.

You can read about the "CesiumIon" key in [Cesium Ion](/thirdpartykeyscesiumion).

## Weather

The "OpenWeather" key loads the rain, wind and temperature weather layers in the web Navigator, from OpenWeather's map tiles. Bookmarks save which layers are on and their opacity, not the key.

The bruce-models "ProgramKey.EProgramId" enum does not include "OpenWeather", so pass it as a plain string.

## Set the keys

Save each key under its own program ID. The program IDs are "BingMaps", "Mapbox", "StadiaMaps", "Thunderforest" and "OpenWeather".

### Set a map layer key

```http
POST https://{accountId}.api.nextspace.host/programkey
```

**Requires:**

- Account ID: Account ID must be specified in the subdomain of the request url.
- Logged in user auth token: A token for an active user session on the account, sent as "Authorization: Bearer <token>".

| Parameter | In | Required | Description |
| --- | --- | --- | --- |
| `{accountId}` | path | yes | The account id of the account to perform the request on. |

**Example request body**

```json
{
    "ProgramId": "Thunderforest",
    "Key": "your-thunderforest-api-key"
}
```

**Response**

```typescript
// The response is the saved Program Key record.
```

**Javascript example**

```javascript
const url = "https://{accountId}.api.nextspace.host/programkey";
const method = "post";
const token = "your-token";
const body = {
    "ProgramId": "Thunderforest",
    "Key": "your-thunderforest-api-key"
};

async function doRequest(type, url, body, token) {
    const headers = {
        "Authorization": `Bearer ${token}`,
        "Content-Type": "application/json"
    };
    const options = {
        method: type,
        headers: headers,
        body: body ? JSON.stringify(body) : null
    };
    const res = await fetch(url, options);
    const json = await res.json();
    return json;
}

doRequest(method, url, body, token).then((res) => {
    console.log(res);
}).catch((err) => {
    console.error(err);
});
```

---

Urls on this page are resolved for account `{accountId}`.
Site index: https://docs.nextspace.host/llms.txt · whole site in one file: https://docs.nextspace.host/llms-full.txt
Human-readable version of this page: https://docs.nextspace.host/thirdpartykeysmaplayers
