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

@atlas-composer/projection-loader

v2.1.0

Published

Zero-dependency standalone loader for composite map projections with plugin architecture. Supports Atlas composer 2.0+ presets with backward compatibility.

Readme

@atlas-composer/projection-loader

A simple runtime engine for composite projections.

This package allows you to render composite projections exported from Atlas Composer in your own applications. It is lightweight, and works seamlessly with D3.js.

Features

  • Zero runtime dependencies (excluding your choice of projection library).
  • plugin architecture: Only import the projection definitions you need.
  • Type-Safe: Written in TypeScript with full type definitions.

Installation

npm install @atlas-composer/projection-loader d3-geo

Usage

import { ProjectionLoader } from '@atlas-composer/projection-loader'
import * as d3 from 'd3-geo'
import config from './my-exported-config.json'

// Create a loader instance
const loader = new ProjectionLoader()

// Register the projections required by your composite projection
loader.register('mercator', () => d3.geoMercator())
loader.register('conic-conformal', () => d3.geoConicConformal())

// Load the composite projection
const projection = loader.load(config, {
  width: 800,
  height: 600
})

// Use with D3
const path = d3.geoPath(projection)

d3.select('svg')
  .selectAll('path')
  .data(geojson.features)
  .join('path')
  .attr('d', path)

API

ProjectionLoader

  • new ProjectionLoader() - Create a loader instance
  • loader.register(id, factory) - Register a projection factory
  • loader.registerAll(factories) - Register multiple projections from an object
  • loader.load(config, options) - Load a composite projection from configuration
  • loader.loadFromJSON(jsonString, options) - Load from a JSON string
  • loader.isRegistered(id) - Check if a projection is registered
  • loader.getRegistered() - Get all registered projection IDs
  • loader.unregister(id) - Remove a registered projection
  • loader.clear() - Clear all registered projections

CompositeProjectionLike

The projection returned by loader.load() supports dynamic scaling:

const projection = loader.load(config, { width: 960, height: 500 })

// Get/set scale dynamically (recalculates all sub-projections)
projection.scale() // Get current scale
projection.scale(5000) // Set new scale

// Get/set translate dynamically
projection.translate() // Get current translate [x, y]
projection.translate([480, 250]) // Set new translate

// Fit to new dimensions (compatible with Observable Plot)
projection.fitSize([800, 600], {})

// Fit to extent with margins
projection.fitExtent([[20, 20], [780, 580]], {})

// Inversion works with dynamic scaling
projection.invert([400, 300]) // Returns [lon, lat] or null

This makes the projection fully compatible with Observable Plot's auto-sizing behavior.

Acknowledgments

This package uses composite projection techniques derived from d3-geo by Mike Bostock (ISC License), with inspiration from d3-composite-projections by Roger Veciana. See NOTICES.md for details.

License

MIT © ShallowRed