planRequestedImage
Works out what a request for an image asks for, so every adapter refuses
the same requests: the map on screen as it is gives undefined, and
anything with a size, a pixel ratio or a view gives the request in full.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { planRequestedImage } from "@mapcairn/core";
function planRequestedImage(options: MapImageOptions, visible: VisibleMap): RequestedImage | undefined;
Description
The CSS size is rounded to whole pixels, because MapLibre draws a canvas of
round(ratio * floor(width)) pixels from a container's width, and the
rounded size is the one returned. A box has its west below its east, and one
across the antimeridian is in the short form, with its east past 180.
Parameters
options(MapImageOptions)visible(VisibleMap)
Returns
RequestedImage | undefined
Throws
- MapImageExportError of kind
invalidfor a size, ratio or view that is not a finite, positive or on-planet number (latitudes within the Web Mercator limit, longitudes within -180 to 180, except the east of a box across the antimeridian, which may be up to 360 degrees past its west), or leaves under one pixel, and of kindtoo-largefor an image overMAX_IMAGE_SIDE_PXon a side orMAX_IMAGE_PIXELSin all. It throws before any engine work.