JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 362
  • Score
    100M100P100Q90574F
  • License MIT

Package Exports

  • japanmesh

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (japanmesh) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

japanmesh

Build Status codecov npm version MIT License

About

JIS 規格で定められている地域メッシュを扱うためのユーティリティです。
地域メッシュコード、緯度経度の相互変換がおこなえます。

地域メッシュの区分は下記の通りです。

レベル 区画の種類 コード桁数 一辺の長さ
1 第1次地域区画 4桁 約80km
2 第2次地域区画 6桁 約10km
3 基準地域メッシュ(第3次地域区画) 8桁 約1km
4 2分の1地域メッシュ 9桁 約500m
5 4分の1地域メッシュ 10桁 約250m
6 8分の1地域メッシュ 11桁 約125m

Installation

$ npm install japanmesh

Usage

const japanmesh = require('japanmesh')

japanmesh.toCode(lat, lng[, level])

指定した緯度経度(WGS84)から、地域メッシュコードを取得します。

japanmesh.toCode(35.70078, 139.71475, 3)
=> '53394547'

japanmesh.toGeoJSON(code[, properties])

指定した地域メッシュコードから、ポリゴンデータ(GeoJSON)を取得します。

japanmesh.toGeoJSON('53394547')
=>{
    "type": "Feature",
    "properties": {},
    "geometry": {
      "type": "Polygon",
      "coordinates": [
        [
          [139.725, 35.70833333333333],
          [139.7125, 35.70833333333333],
          [139.7125, 35.699999999999996],
          [139.725, 35.699999999999996],
          [139.725, 35.70833333333333]
        ]
      ]
    }
  }

japanmesh.getLevel(code)

指定した地域メッシュコードのレベルを取得します。

japanmesh.getLevel('53394547')
=> 3

japanmesh.getCodes([code])

指定した地域メッシュコードの直下のレベルの地域メッシュコードを取得します。
未指定時はレベル1(第1次地域区画)の地域メッシュコードを取得します。

japanmesh.getCodes('53394547')
=> [ '533945471', '533945472', '533945473', '533945474' ]

License

This project is licensed under the terms of the MIT license.