Skip to content

Repository files navigation

Atlas

CI

Candidate CRS lookup for Maplat V3.1, usable from Node.js and browser runtimes. Atlas searches proj.db through proj-wasm and can optionally merge JSON-defined custom projections such as UTJCP historical zones.

日本語のREADMEはこちら

Features

  • Lookup projected CRS candidates from a geographic extent
  • Filter by area string, deprecated flag, and onshore-only preference
  • Apply configurable bbox padding during containment tests
  • Merge built-in or user-provided JSON projection definitions
  • Keep browser demo logic outside the published package surface

Requirements

  • Node.js >= 20
  • pnpm >= 10 for development

Installation

pnpm

pnpm add @c4h/atlas

npm

npm install @c4h/atlas

Basic Usage

import { listProjectedCrsFromProjWasm } from "@c4h/atlas";

const rows = await listProjectedCrsFromProjWasm({
  extent: { west: 135.4, south: 34.55, east: 135.65, north: 34.8 },
  area: "Japan",
  onshoreOnly: true,
});

console.log(rows.map((row) => row.id));

transformLonLatArrayToProjected converts a lon/lat array (degrees, lon-lat order) into the projected coordinates of a candidate CRS. The return value is always [easting, northing], in the same order and count as the input, or null.

import { listProjectedCrsFromProjWasm, transformLonLatArrayToProjected } from "@c4h/atlas";

const [target] = await listProjectedCrsFromProjWasm({
  extent: { west: 135.6, south: 34.9, east: 135.9, north: 35.1 },
  area: "Japan",
  onshoreOnly: true,
});

const projected = await transformLonLatArrayToProjected(target, [
  [135.6, 34.9],
  [135.9, 35.1],
]);

console.log(projected); // [[easting, northing], [easting, northing]] or null

null means "not transformable as a business outcome". It is returned for an empty input, for a non-finite input or output component (no partial success), and for a target whose definition is not a CRS, whose axes are not east/north, or whose units are not metres (units are never converted). Exceptions are reserved for implementation bugs. The function accepts lon/lat degree input only.

Development

  • pnpm run dev: start the local demo site
  • pnpm run build: build the published package into dist/
  • pnpm run build:demo: build the GitHub Pages demo into dist-demo/
  • pnpm run verify:demo: build and verify the GitHub Pages artifact
  • pnpm run test: run the Vitest suite

Publish

pnpm publish is guarded by prepublishOnly, which runs:

  • pnpm run test
  • pnpm run typecheck
  • pnpm run build
  • pnpm run verify:demo

Demo

  • Root portal: index.html
  • Demo app: demo/crs-candidate-lookup.html
  • GitHub Pages target: https://code4history.github.io/Atlas/

License

MIT License. See LICENSE.

About

Candidate CRS catalog lookup for Maplat V3.1.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages