npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

d3-geo-albers-usa-mapshaper

v1.0.0

Published

A D3.js composite projection that exactly replicates mapshaper's albersusa projection.

Readme

d3-geo-albers-usa-mapshaper

A d3-geo composite projection that roughly matches Mapshaper’s albersusa projection. This was mostly for fun, I wouldn't use it to line up geometries generated in Mapshaper.

The lower 48 use geoAlbers. Alaska and Hawaii use separate geoConicEqualArea definitions with Mapshaper’s standard parallels, rotations, and inset placement (Alaska is drawn at reduced scale relative to the contiguous states).

Installing

With npm:

npm install d3-geo-albers-usa-mapshaper

Usage

import { geoAlbersUsaMapshaper } from "d3-geo-albers-usa-mapshaper";

const projection = geoAlbersUsaMapshaper();

// Typical D3 pattern: size to a viewport
const path = d3.geoPath().projection(
  projection.fitSize([width, height], geojson)
);

API Reference

# geoAlbersUsaMapshaper()

Constructs a new Mapshaper-compatible Albers USA projection. The returned object is a function (coordinates) => [x, y] plus the methods below.

# projection.scale([scale])

If scale is specified, sets the overall scale factor and updates component projections. If omitted, returns the current scale.

# projection.translate([point])

If point is specified, sets the translation [x, y] and recomputes clip extents and inset positions. If omitted, returns the current translation.

# projection.precision([precision])

If precision is specified, sets adaptive sampling precision on all component projections (see projection.precision). If omitted, returns the current precision.

# projection.stream(stream)

Returns a composite geo stream for rendering.

# projection.invert(point)

Given pixel coordinates [x, y], returns [longitude, latitude] by delegating to the lower 48, Alaska, or Hawaii projection based on inset bounds.

# projection.fitExtent(extent, object)
# projection.fitSize(size, object)
# projection.fitWidth(width, object)
# projection.fitHeight(height, object)

Convenience methods to set scale and translate so the given GeoJSON object fits the viewport; see fitExtent and related helpers in d3-geo.

Limitations

This projection fixes clip extents, centers, and rotations internally to mirror Mapshaper’s layout. It does not expose generic projection.center, projection.rotate, projection.clipAngle, or projection.clipExtent on the composite object the way a single-region d3 projection would.

Puerto Rico and other territories are not included as separate insets in this implementation.

License

ISC. See LICENSE.