> ## 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.

# Map settings, keyed tiles and exports

`maps({...})` from `@bijectionhq/library-geo/maps/library` keeps what every map of a
deployment reads: its basemaps, units, refresh interval and watermarks, the
keyed tile providers it may draw, and an audit of every export. Place it in
the app tree and show it in the console with `panel("maps", siteMaps)`.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { app, label, role, secret } from "@bijectionhq/bijection";
import { maps } from "@bijectionhq/library-geo/maps/library";
import { web } from "@bijectionhq/pack-providers";

export const member = role({});
export const admin = role({});
export const contractor = role({});

export const ionToken = secret();
export const ion = web({ endpoint: "https://api.cesium.com", auth: { kind: "bearer", secret: ionToken } });

export const siteMaps = maps({
  label: label.public,
  readers: [member],
  administrators: [admin],
  groups: { contractors: contractor },
  watermark: "Internal",
  basemaps: {
    streets: {
      label: "Streets",
      basemap: { kind: "style", url: "https://tiles.openfreemap.org/styles/liberty", attribution: "OpenFreeMap", license: "https://openfreemap.org" },
    },
  },
  providers: {
    terrain: { label: "World terrain", kind: "tiles3d", session: ion.get, args: { path: "/v1/assets/1/endpoint", query: null } },
  },
});

export default app({ member, admin, contractor, ionToken, ion, siteMaps });
```

| Function | `allow` | What |
| - | - | - |
| `settings.get` | readers | The settings, every basemap option, the providers, the reader's watermark, and whether the reader administers |
| `settings.save` | administrators | Replace the settings at the revision read: `StaleRevision` when they changed, `InvalidSettings` when one is refused |
| `sessions.open`, `sessions.get` | readers | Open the provider's session through its target, unless a live or pending one exists; read it (`none`, `pending`, `ready`, `expired`, `failed`) |
| `exports.record` | readers | Record an export before it is downloaded; answers the watermark it carries |
| `exports.page` | administrators | The export audit, newest first |

## Settings

An administrator sets the default basemap, the units (`metric`,
`imperial`, `nautical`), the time zone and time window a timeline opens on,
how often a GeoJSON URL overlay is fetched again, and the number of objects
above which a layer counts its objects per cell. They may add up to 16
custom basemaps (raster tiles, a style URL, or a PMTiles archive). A custom
basemap is keyless: a URL that carries a query string, a fragment or user
information is refused, so no key is ever stored in a fact.

## Keyed providers

A provider that needs a key is declared in code. Its key is a `secret()`,
set with `bijection secret set`, held by the target that opens the
provider's sessions: an `http(...)` target, or a pack receiver such as
`web(...)`. The console opens a session with `sessions.open` and reads it
with `sessions.get`. The browser then reads tiles straight from the
provider with the session's short-lived URL, query and headers, and every
request stays on the session's origin. The key never reaches the browser,
and no deployment proxy serves tiles.

A session answer is `{ url, query?, headers?, expires?, attributions? }`,
or a Cesium ion asset endpoint (`{ url, accessToken, attributions }`). A
basemap provider also names its raster tiles, relative to the session URL:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
providers: {
  satellite: {
    label: "Satellite",
    kind: "basemap",
    session: imagerySession,
    raster: { tiles: "v1/{z}/{x}/{y}.jpg", tileSize: 256, maxZoom: 19, attribution: "Imagery partner", license: "https://imagery.example.com/terms" },
  },
},
```

## Watermarks and exports

Each watermark rule names one of the `groups` and a text. A reader sees the
first rule whose group role they hold, or the deployment's own `watermark`.
The console shows it over every map and burns it into every image it
exports. An export (an image of the map, or the GeoJSON of its GeoJSON
overlays) is recorded with `exports.record` first and downloaded only once
its receipt is kept. The receipt names the map, its title, format, bounds,
layers, the watermark, who exported it and when.

## Saved maps and overlays

The maps themselves are the reader's saved console items. An overlay is
uploaded or pasted GeoJSON, a GeoJSON URL, raster or vector tiles, a GL
style fragment of tile sources and layers, a 3D Tiles tileset (by URL, or a
keyed provider's), or annotations drawn on the map (text, lines, areas and
measures). A map names its overlays in drawing order, the area it opens on
and its basemap. Every overlay URL obeys the same keyless rule, and a GL
style may not hold a GeoJSON source.


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