Skip to content

The world grid square is extension of JIS X0410(a.k.a. Japan Mesh Code) worldwide. This library is utilities for the world grid square.

License

Notifications You must be signed in to change notification settings

glassonion1/world-grid-square-ts

Repository files navigation

World Grid Square

npm version MIT licensed

The world grid square is extension of JIS X0410(a.k.a Japan Mesh Code) worldwide. This library is utilities for the world grid square.

World grid square outlined here: https://www.fttsus.org/worldgrids/en/top-en/

Compartment type

  • 1st level 80km grid
  • 2nd level 10km grid
  • 3rd level 1km grid
  • 4th level 500m grid
  • 5th level 250m grid
  • 6th level 125m grid
  • 7th level 25m grid(extension spec)
  • 8th level 12.5m grid(extension spec)
  • 9th level 5m grid(extension spec)

Install

$ npm install world-grid-square

or

$ yarn add world-grid-square

or

$ pnpm add world-grid-square

Usage

from longitude and latitude to code

import { wgs } from 'world-grid-square'

const code = wgs.pointToCode(139.745433, 35.658581, 6)
// 2053393599212
console.log(code)

from code to longitude and latitude

import { wgs } from 'world-grid-square'

const point = wgs.codeToPoint('2053393599212')
// 139.7453125, 35.65833333333333
console.log(point)

Usage for JIS Grid Square

from longitude and latitude to jis code

import { wgs } from 'world-grid-square'

const code = wgs.pointToJisCode(139.745433, 35.658581, 6)
// 53393599212
console.log(code)

from jis code to longitude and latitude

import { wgs } from 'world-grid-square'

const point = wgs.jisCodeToPoint('53393599212')
// 139.7453125, 35.65833333333333
console.log(point)

Demo using map

Here is a demo that actually draws the world grid square on the map using this library.
https://9revolution9.com/tools/geo/geocode/

About

The world grid square is extension of JIS X0410(a.k.a. Japan Mesh Code) worldwide. This library is utilities for the world grid square.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published