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/cli

v0.2.0

Published

Command that writes the territories of an Atlas Composer atlas and the composed geometries of a composite projection as GeoJSON

Readme

@atlas-composer/cli

Command that writes the territories of an Atlas Composer atlas as GeoJSON, for GIS and tile tools.

The atlas-composer command reads the atlases and the presets of @atlas-composer/preset-library and the countries of Natural Earth from world-atlas.

Installation

npm install @atlas-composer/cli

Territories of an atlas

npx atlas-composer territories france > france.geojson

territories <atlas> writes to the standard output a GeoJSON FeatureCollection with one feature per territory of the atlas, in longitudes and latitudes. Each feature has the id, the code, the name and the iso of its territory in properties. The rings follow RFC 7946: exterior rings counterclockwise, and a ring that crosses the antimeridian cut in two. At 50m, GEOS reads each geometry as valid; at 10m and 110m, some rings of Natural Earth cross themselves and GEOS reads their geometries as invalid: ogr2ogr -makevalid repairs them.

  • --resolution 10m|50m|110m chooses the Natural Earth resolution, 50m by default. The extraction rules of the atlases count the polygons of a country in the 50m topology: at 10m and 110m, each polygon goes to the territory of the 50m polygon that contains it or is nearest, and a polygon that Natural Earth draws at this resolution only, farther than 50 km and outside the bounds of its territory, is left out.
  • --data <file> reads the geometries from a JSON file of GeoJSON features, each with the code of a territory of the atlas in properties.code, in place of Natural Earth.

Territories placed in a composite projection

npx atlas-composer compose france-standard --out france-standard.geojson

compose <preset> places each territory as the composite-custom preset draws it, with the overseas territories next to the mainland, and writes two files:

  • france-standard.geojson, a GeoJSON FeatureCollection of the placed territories;
  • france-standard.geojson.json, with the canvasDimensions and the referenceScale of the composition, the codes of the territories that the preset leaves out in skippedCodes, and the codes of the territories that their frame clips entirely in emptyCodes.

compose <file.json> reads a configuration exported from the Atlas Composer app, for the atlas that its metadata.atlasId names. --data <file> reads the geometries as for territories; without it, compose reads Natural Earth at the resolution of --resolution, 50m by default.

Coordinates of the composed file

The coordinates of the composed file are longitudes and latitudes that draw the composition in Web Mercator: display the file in EPSG:3857, or reproject it from EPSG:4326 to EPSG:3857. The longer side of the canvas spans the 360° of longitude, and the center of the canvas is at longitude 0 and latitude 0. A longitude of the file is a position in the composition, unrelated to the longitude of the territory on the globe.

The file is for GIS and tile tools, such as QGIS, GDAL, tippecanoe or MapLibre. d3-geo joins two vertices by a great-circle arc and reads the orientation of RFC 7946 as an inverted territory: with d3, load the preset with @atlas-composer/projection-loader.

One territory per code

compose projects each territory through the sub-projection of its code, clipped to its frame and to the canvas, as the editor of the Atlas Composer app draws it. A territory that the preset leaves out has no sub-projection, and is missing from the composed file: US-ALEU, US-VI and US-MP in usa-pseudo-d3cp. The editor draws such a territory once it is checked, with default parameters. A territory whose geometry falls in the frame of another one is drawn once, in its own frame: FR-MF and FR-BL in france-proportional.

PROJ pipelines of a composite projection

npx atlas-composer describe france-standard > france-standard.proj.json

describe <preset> writes to the standard output, as JSON, the PROJ pipeline of each territory of the composite-custom preset, from longitudes and latitudes in degrees to the pixels of the canvas, and the ring of its frame in clip. describe <file.json> reads a configuration exported from the Atlas Composer app. The command reads no geometry. The README of @atlas-composer/projection-loader describes the form of the pipelines, their use with cct, pyproj and GDAL, and their limits.

API

import { composeTerritories, naturalEarthSource } from '@atlas-composer/cli'
import { buildTerritories, getPreset } from '@atlas-composer/preset-library'
import atlas from '@atlas-composer/preset-library/atlases/france' with { type: 'json' }
import { ProjectionLoader } from '@atlas-composer/projection-loader'
import { d3ProjectionFactories } from '@atlas-composer/projection-loader/helpers'

const loader = new ProjectionLoader()
loader.registerAll(d3ProjectionFactories)

const { collection: territories } = buildTerritories(atlas, naturalEarthSource('50m'))
const config = await getPreset('france-standard')
if (!config) {
  throw new Error('Unknown preset')
}
const { collection, skippedCodes, emptyCodes } = composeTerritories(loader, config, territories)

naturalEarthSource(resolution) reads the countries of world-atlas as a source of buildTerritories. composeTerritories(loader, config, territories) returns the composed collection with canvasDimensions, referenceScale, skippedCodes and emptyCodes.

License

MIT