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

kma-grid

v1.0.5

Published

Library to convert latitude longitude coordinates to KMA Grid coordinates

Readme

kma-grid

kma-grid는 위도와 경도를 기상청 단기예보 API에서 사용하는 Lambert Conformal Conic 격자 좌표로 변환하는 JavaScript/TypeScript 라이브러리입니다.

기상청 단기예보 OpenAPI의 nx, ny 값을 만들 때 사용할 수 있습니다.

설치

npm install kma-grid

빠른 사용법

import Coordinate from "kma-grid";

const coord = new Coordinate(37.488201, 126.92981);

console.log(coord.gridX); // 59
console.log(coord.gridY); // 125
console.log(coord.grid);  // { x: 59, y: 125 }

인자 순서는 latitude, longitude입니다. 즉, 위도, 경도 순서입니다.

변환기 직접 사용

import { KmaGridConverter } from "kma-grid";

const converter = new KmaGridConverter();
const grid = converter.toGrid(37.488201, 126.92981);

console.log(grid); // { x: 59, y: 125 }

역변환

기상청 격자 좌표를 다시 위경도로 바꿀 수 있습니다.

import { KmaGridConverter } from "kma-grid";

const converter = new KmaGridConverter();
const latLng = converter.toLatLng(59, 125);

console.log(latLng);
// { latitude: 37.488201..., longitude: 126.929810... }

실수 격자 확인

반올림 전 계산 결과가 필요하면 toGridRaw()를 사용할 수 있습니다.

import { KmaGridConverter } from "kma-grid";

const converter = new KmaGridConverter();
const raw = converter.toGridRaw(37.488201, 126.92981);

console.log(raw);

격자 범위 확인

import { KmaGridConverter } from "kma-grid";

const converter = new KmaGridConverter();

console.log(converter.isValidGrid(59, 125)); // true
console.log(converter.isValidGrid(0, 125));  // false

모듈 형식

이 패키지는 ESM 패키지입니다.

import Coordinate from "kma-grid";
import { KmaGridConverter } from "kma-grid";

CommonJS의 require() 전용 프로젝트에서는 동적 import를 사용해야 합니다.

const { default: Coordinate, KmaGridConverter } = await import("kma-grid");

API

new Coordinate(latitude, longitude)

위도와 경도를 받아 좌표 객체를 만듭니다.

Coordinate.gridX

기상청 API에 사용할 격자 X 좌표를 반환합니다.

Coordinate.gridY

기상청 API에 사용할 격자 Y 좌표를 반환합니다.

Coordinate.grid

{ x, y } 형태의 정수 격자 좌표를 반환합니다.

Coordinate.rawGrid

반올림 전의 실수 격자 좌표를 반환합니다.

new KmaGridConverter(params?)

커스텀 투영 파라미터를 사용하는 변환기를 생성합니다.

KmaGridConverter.toGrid(latitude, longitude)

위경도를 기상청 정수 격자로 변환합니다.

KmaGridConverter.toGridRaw(latitude, longitude)

반올림 전의 실수 격자 좌표를 반환합니다.

KmaGridConverter.toLatLng(x, y)

기상청 정수 격자 좌표를 위경도로 역변환합니다.

KmaGridConverter.isValidGrid(x, y)

기본 기상청 단기예보 격자 범위 기준으로 x, y가 유효한지 확인합니다.

개발

npm ci
npm test
npm run build
npm run pack:check

라이선스

MIT License