# encodeShapes

Writes finished, valid shapes as a short text for a link: one letter for
the kind (`p` point, `l` line, `g` polygon, `c` circle) and then the
positions as whole units of 0.00001 degrees (about a metre), the first
absolute and each later one as the step from the one before, every number
zigzagged and packed five bits to a character in the alphabet
`A-Z a-z 0-9 - _`. Shapes are separated by a full stop. Only link-safe characters are
used, so nothing needs escaping. A circle's radius is in whole metres.

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

## Signature

```ts
import { encodeShapes } from "@mapcairn/core";
 
function encodeShapes(shapes: readonly DrawShape[]): string | null;
```

## Description

A shape the link cannot carry (see [`unsharableShapes`](https://docs.mapcairn.com/api/core/unsharableShapes.md)) is left out,
and a caller tells the person.

## Parameters

- `shapes` (`readonly DrawShape[]`)

## Returns

`string | null`: The text, an empty string when there is nothing to share, or
 null when the result would pass [`MAX_SHARE_LENGTH`](https://docs.mapcairn.com/api/core/MAX_SHARE_LENGTH.md) characters or
 [`MAX_SHARE_SHAPES`](https://docs.mapcairn.com/api/core/MAX_SHARE_SHAPES.md) shapes. A set is never cut short for its size:
 the caller says it is too big.

## See also

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

Source: [packages/core/src/draw/share.ts:134](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/draw/share.ts#L134)
