# mountMap

Draws a map in `element` and returns the handle to move, change and remove
it. Every option is optional: `mountMap(element)` draws a world map on the
built-in basemap, in the device's colour scheme, with zoom, a compass, the
credits and the scale. Name more in `tools`, and give `layers` and
`languages` as plain data. The element needs a height in CSS.

This is a function exported by `@mapcairn/sdk/browser`, checked against version 0.2.0.

## Signature

```ts
import { mountMap } from "@mapcairn/sdk/browser";
 
function mountMap(element: HTMLElement, options?: MountMapOptions): MapHandle;
```

## Parameters

- `element` (`HTMLElement`)
- `options?` (`MountMapOptions`)

## Returns

`MapHandle`

## Throws

- MountMapError when called where there is no browser, when the
   element already holds a map, or when an option cannot be used. The message
   says what to change.

## Examples

```ts
const map = mountMap(document.getElementById("map"));
map.on("viewchange", (view) => console.log(view.zoom));
map.destroy();
```

## See also

- [`MountMapOptions`](https://docs.mapcairn.com/api/sdk/browser/MountMapOptions.md)
- [`MapHandle`](https://docs.mapcairn.com/api/sdk/browser/MapHandle.md)

Source: [packages/sdk/src/browser/mountMap.ts:31](https://github.com/MapCairn/mapcairn/blob/main/packages/sdk/src/browser/mountMap.ts#L31)
