# 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

```ts
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 `invalid` for 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 kind `too-large` for an image over
   [`MAX_IMAGE_SIDE_PX`](https://docs.mapcairn.com/api/core/MAX_IMAGE_SIDE_PX.md) on a side or [`MAX_IMAGE_PIXELS`](https://docs.mapcairn.com/api/core/MAX_IMAGE_PIXELS.md) in all. It
   throws before any engine work.

## See also

- [`MapImageOptions`](https://docs.mapcairn.com/api/core/MapImageOptions.md)
- [`VisibleMap`](https://docs.mapcairn.com/api/core/VisibleMap.md)
- [`RequestedImage`](https://docs.mapcairn.com/api/core/RequestedImage.md)

Source: [packages/core/src/imageExport/plan.ts:76](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/imageExport/plan.ts#L76)
