# @metamorfosilab/meta-map

> Package for using interactive map in you project :)

Latest version **0.0.9** (published 2024-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @metamorfosilab/meta-map
pnpm add @metamorfosilab/meta-map
yarn add @metamorfosilab/meta-map
bun add @metamorfosilab/meta-map
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2024-01-30 |
| First published | 2024-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 3.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | karaaa006, hrynevychroman |
| Keywords | map, typescript, vite |

## Links

- npm: https://www.npmjs.com/package/@metamorfosilab/meta-map
- Repository: https://github.com/MetamorfosiLab/meta-map
- Homepage: https://github.com/MetamorfosiLab/meta-map#readme
- Issues: https://github.com/MetamorfosiLab/meta-map/issues
- npm.io page: https://npm.io/package/@metamorfosilab/meta-map

## Dependencies (7)

- [pathe](https://npm.io/package/pathe.md) ^1.1.2
- [d3-geo](https://npm.io/package/d3-geo.md) ^3.1.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [d3-zoom](https://npm.io/package/d3-zoom.md) ^3.0.0
- [d3-fetch](https://npm.io/package/d3-fetch.md) ^3.0.1
- [d3-selection](https://npm.io/package/d3-selection.md) ^3.0.0
- [d3-transition](https://npm.io/package/d3-transition.md) ^3.0.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2024-01-30
- 0.0.7 — 2024-01-19
- 0.0.6 — 2024-01-19
- 0.0.5 — 2024-01-19
- 0.0.4 — 2024-01-19
- 0.0.1 — 2024-01-18

## README

# MetaMap

![MetaMap Logo](link-to-your-logo.png)

**MetaMap** is a JavaScript library for creating interactive maps of countries with markers. It is built using D3.js and provides a flexible and customizable way to visualize geographic data.

## Installation

You can install MetaMap via pnpm:

```bash
pnpm install @metamorfosilab/meta-map
```

## Configuration Options

| Key                 | Type                | Default               | Description                                       |
| ------------------- | ------------------- | --------------------- | ------------------------------------------------- |
| `mapPath`           | string              | *Required             | Path to topographic map data.                     |
| `maxZoom`           | number              | 20                    | Maximum zoom level for the map.                   |
| `countryStrokeWidth`| string              | "0.25px"              | Stroke width for country borders.                 |
| `countryFillColor`  | string \| object    | "#cccccc"             | Color of countries. Can be a string or a gradient object. |
| `countryStrokeColor`| string              | "#ffffff"             | Color of country borders.                         |
| `accentFillColor`   | string \| object    | "red"                 | Color of selected countries. Can be a string or a gradient object. |
| `accentStrokeColor` | string              | "#ffffff"             | Color of borders for selected countries.         |
| `groupFillColor`    | string              | "yellow"              | Fill color for country groups.                    |
| `width`             | number \| string    | 900                   | Width of the map.                                 |
| `height`            | number \| string    | 600                   | Height of the map.                                |
| `markers`           | array: object       | []                    | Array of markers with longitude, latitude, and optional properties. |
| `markerStyle`       | object              | { color: "blue", img: null, width: 20, height: 20 } | Style configuration for markers, including color, size, and image. |
| `countryGroups`     | array: object       | null                  | Array of country groups.                          |
| `selectedCountries` | array: string       | []                    | Array of selected countries.                     |
| `isZoomable`        | boolean             | false                 | Enable map zooming.                               |
| `zoomedCountries`   | array: string       | []                    | Array of countries to zoom in after initialization. |
| `on`               | object               | {}                    | Object with event listeners.                     |

### Gradient Fill Color

To pass a gradient color, use an object with the following fields:

- `rotate`: Gradient rotation angle.
- `startColor`: Start color of the gradient (extended settings possible).
- `endColor`: End color of the gradient (extended settings possible).

Example:

```
// ...config
countryFillColor: {
rotate: 65,
startColor: { color: "#061654", offset: "0%" },
endColor: { color: "#04143A", offset: "100%" },
},
accentFillColor: {
rotate: 65,
startColor: { color: "#04143A", offset: "20%" },
endColor: { color: "#E4B700", offset: "60%" },
},
```

### Country Groups

- `id`: Unique identifier for the group.
- `countryList`: Array of country IDs in the group.

## Methods

- `map.selectCountry(id)`: Highlight a country on the map.
- `map.selectCountryList(idList)`: Highlight an array of countries on the map.
- `map.unselectCountry(id)`: Remove highlighting from a country.
- `map.unselectAllCountries()`: Remove highlighting from all countries.
- `map.zoomCountries(idList)`: Zoom the map to the specified countries.
- `map.moveToCountries(idList)`: Move the map to

---
_Source: https://npm.io/package/@metamorfosilab/meta-map · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
