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
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
const map = mountMap(document.getElementById("map"));
map.on("viewchange", (view) => console.log(view.zoom));
map.destroy();