Skip to main content

MapImageOptions

Options for MapAdapter.

This is an interface exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import type { MapImageOptions } from "@mapcairn/core";

interface MapImageOptions

Properties​

attribution​

readonly attribution?: string;

Credit text drawn along the bottom edge of the image, so a saved image keeps its sources. Nothing is drawn when it is empty or omitted.

drawing​

readonly drawing?: MapImageDrawing;

What the ui draws over the map (such as shapes a person has drawn), put into the image above the data layers and below the credit text.

pixelRatio​

readonly pixelRatio?: number;

Image pixels for each CSS pixel of size. Defaults to 1, whatever the device.

size​

readonly size?: MapImageSize;

The size of the map the image shows, in CSS pixels, so labels and symbols are as large against it as on a screen of that size. The image is this many times pixelRatio pixels on each side. The size is rounded to whole CSS pixels first, and the image's pixels to whole pixels. Defaults to the size of the map on screen.

view​

readonly view?: MapImageView;

What the image shows. Defaults to where the map on screen is looking, but north-up. It is drawn without moving the map on screen. Latitudes are within the Web Mercator limit and longitudes within -180 to 180; a box has its west below its east, and one across the antimeridian is given in the short form, with its west inside -180 to 180 and its east past 180 (the box of a Fiji-sized view is west: 178.44, east: 180.1), at most 360 degrees past its west. The long form, with its west beyond its east, is invalid, and so is a west below -180 or above 180. A very wide box can also be invalid from the framing check below. A box the map cannot frame at the requested size (below the basemap's lowest zoom, or one it would have to crop to fit) is invalid too, and so is any box on a globe for now (a centre and zoom is drawn on either). What getBounds() gives for a world-wide view (longitudes beyond -180 and 180, or latitudes beyond the limit) is not an acceptable bounds. When a request names only a size or pixel ratio, the view on screen is used, with its latitude clamped to the Web Mercator limit and its longitude wrapped.

See also​

Source: packages/core/src/ports/map.ts:362