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はこちら。
- 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
- Node.js >= 20
- pnpm >= 10 for development
pnpm add @c4h/atlasnpm install @c4h/atlasimport { 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 nullnull 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.
pnpm run dev: start the local demo sitepnpm run build: build the published package intodist/pnpm run build:demo: build the GitHub Pages demo intodist-demo/pnpm run verify:demo: build and verify the GitHub Pages artifactpnpm run test: run the Vitest suite
pnpm publish is guarded by prepublishOnly, which runs:
pnpm run testpnpm run typecheckpnpm run buildpnpm run verify:demo
- Root portal:
index.html - Demo app:
demo/crs-candidate-lookup.html - GitHub Pages target:
https://code4history.github.io/Atlas/
MIT License. See LICENSE.