open-index/open-npm huggingface dataset:
npm package: @giapspzoo/use-map-cursor-coords
Description: A React hook to retrieve the current cursor coordinates from an OpenLayers map.
Author: GIAP sp. z o.o.
Latest version: 1.0.0

# @giapspzoo/use-map-cursor-coords
A React hook to retrieve the current cursor coordinates from an OpenLayers map.

## Installation
```
npm i @giapspzoo/use-map-cursor-coords
```

## API
### `useMapCursorCoords(map, options?) => [string, string];`
### Parameters
| Name | Type | Description | Default value | Required |
|-|-|-|-|-|
| `map` | `Map` | A reference to an OpenLayers map instance. | - | Yes |
| `options` | `TUseMapCursorCoordsOptions` | Configuration object. | `{}` | No |
| `options.coordinateRoundValue` | `number` | Number of decimal places of coordinate values. | `5` | No |
| `options.resultCrs` | `ProjectionLike` | Result coordinate system. Accepts the `ProjectionLike` type from OpenLayers. | `"EPSG:4326"` | No |

## Examples
```ts
import useMapCursorCoords from '@giapspzoo/use-map-cursor-coords';

// ...

const cursorCoords = useMapCursorCoords(map);
// Result: coords e.g. ['19.47999', '52.06485'] (or `null` if map is not defined)

const cursorCoords = useMapCursorCoords(map, {
    coordinateRoundValue: 2
});
// Result: coords e.g. ['19.47', '52.06'] (or `null` if map is not defined)

const cursorCoords = useMapCursorCoords(map, {
    resultCrs: 'EPSG:3857'
});
// Result: coords e.g. ['2168502.567458', '6811859.670340'] (or `null` if map is not defined)
```