# vega-projection

> Projections for cartographic mapping.

Latest version **2.1.3** (published 2026-08-14) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install vega-projection
pnpm add vega-projection
yarn add vega-projection
bun add vega-projection
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.1.3 |
| Published | 2026-08-14 |
| First published | 2017-08-05 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 3 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12006 |
| Author | Vega |
| Maintainers | domoritz, hydrosquall, jheer, arvindsatya1, lhermann |
| Keywords | vega, geo, projection |

## Links

- npm: https://www.npmjs.com/package/vega-projection
- Repository: https://github.com/vega/vega
- Homepage: https://github.com/vega/vega/tree/main/packages/vega-projection#readme
- Issues: https://github.com/vega/vega/issues
- npm.io page: https://npm.io/package/vega-projection

## Dependencies (3)

- [d3-geo](https://npm.io/package/d3-geo.md) ^3.1.1
- [vega-scale](https://npm.io/package/vega-scale.md) ^8.1.3
- [d3-geo-projection](https://npm.io/package/d3-geo-projection.md) ^4.0.0

## Recent versions

- 2.1.3 (latest) — 2026-08-14
- 1.6.3 (v5-maintenance) — 2026-01-06
- 2.1.2 — 2026-07-22
- 2.1.1 — 2026-07-21
- 2.1.0 — 2025-09-16
- 2.0.0 — 2025-03-27
- 1.6.2 — 2025-01-24
- 1.6.1 — 2024-06-14
- 1.6.0 — 2023-03-01
- 1.5.0 — 2022-03-11
- 1.4.5 — 2020-09-23
- 1.4.4 — 2020-08-31
- 1.4.3 — 2020-08-18
- 1.4.2 — 2020-06-02
- 1.4.1 — 2020-04-27
- … 7 more at https://npm.io/package/vega-projection/versions

## README

# vega-projection

Projections for cartographic mapping.

This package provides a [projection](#projection) method for managing registered cartographic projections. By default, the projection registry includes all projection types provided by the [d3-geo](https://github.com/d3/d3-geo) module.

## API Reference

<a name="projection" href="#projection">#</a>
vega.<b>projection</b>(<i>type</i>[, <i>projection</i>])
[<>](https://github.com/vega/vega/blob/master/packages/vega-projection/src/projections.js "Source")

Registry function for adding and accessing projection constructor functions. The *type* argument is a String indicating the name of the projection type. If the *projection* argument is not specified, this method returns the matching projection constructor in the registry, or `null` if not found. If the *projection* argument is provided, it must be a projection constructor function to add to the registry under the given *type* name.

By default, the projection registry includes entries for all projection types provided by the [d3-geo](https://github.com/d3/d3-geo) module. Projections created using the constructor returned by this method are augmented with the following additional properties:

- `type`: A string value indicating the projection type.
- `path`: A D3 [geoPath](https://github.com/d3/d3-geo#geoPath) instance configured to use the projection. When using this path instance, be sure to set the [path context](https://github.com/d3/d3-geo#path_context) as needed.
- `copy`: A zero-argument function the produces a copy of the projection.


```js
// mercator projection
var mercator = vega.projection('mercator');
var proj = mercator().translate([400, 200]);
scale.type; // 'mercator'
scale([0, 0]); // [400, 200] center point
```

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