Projections
UNMAINTAINED AND PROBABLY NOT WORKING ANYMORE. PLEASE USE PROJ4 INSTEAD. Collection of (stereographic) map/coordinate projections.
Install / Use
/learn @juliuste/ProjectionsREADME
projections
Collection of (stereographic) map projections. See this Wikipedia list.
Installation
npm install --save projections
Usage
const projections = require('projections') // for all projections
const mercator = require('projections/mercator') // for a specific projection
WGS to map coordinates
const {x, y} = mercator.project({lon: 13.5, lat: 52.4})
// x ≊ 0.53722
// y ≊ 0.32686
Given an object containing lon and lat, mercator.project returns an object {x: …, y: …} (0 ≤ x ≤ 1). For details on the range of y, see the map height column in the projections table.
Map coordinates to WGS
const {lon, lat} = mercator.inverse({x: 0.53722, y: 0.32686})
// lon ≊ 13.5
// lat ≊ 52.4
Given an object containing x and y (0 ≤ x ≤ 1), mercator returns an object {lon: …, lat: …}.
Be sure to use the same options everytime you're converting coordinates back and forth to get correct results.
Projections
Projection | Full name | Available options | Map height*
---------- | --------- | ----------------- | -----------
braun | Braun stereographic | meridian, latLimit
central-cylindrical | Central cylindrical | meridian, latLimit
equirectangular | Equirectangular | meridian, standardParallel | 1 / 2
gall | Gall stereographic | meridian, latLimit |
gall-peters | Gall–Peters | meridian | 2 / π
kavrayskiy-7 | Kavrayskiy VII | meridian | 1 / √3
lambert | Lambert cylindrical equal-area | meridian | 1 / π
mercator | Mercator (Web) | meridian, latLimit |
miller | Miller cylindrical | meridian, latLimit |
sinusoidal | Sinusoidal | meridian | 1 / 2
wagner-6 | Wagner VI | meridian | 1 / 2
* If the projection uses a latitude limit, the map height is the value of y at {lon: meridian, lat: -latLimit}. Otherwise it is the value of y at {lon: meridian, lat: -90}.
Options
Option | description | Default
------ | ----------- | -------
meridian | Latitude of the central meridian | 0
latLimit | maximum latitude in degrees < 90 | 85
standardParallel | longitude of the standard parallel(s) | 0
Contributing
If you found a bug, want to propose a feature or feel the urge to complain about your life, feel free to visit the issues page.
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
