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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@digital-go-jp/abr-geocoder

v1.4.0

Published

デジタル庁:アドレス・ベース・レジストリを用いたジオコーダー

Downloads

713

Readme

abr-geocoder

日本語 (Japanese)

Address Base Registry Geocoder by Japan Digital Agency

  • Assigns a town ID.
  • Normalizes address strings.
  • Outputs latitude and longitude pair with matched level.

Index

Documents


Requirement

This command requires node.js version 18 or above.

Install

npm install @digital-go-jp/abr-geocoder

Usage

$ abrg download # Download data from the address base registry and create a database.
$ echo "東京都千代田区紀尾井町1-3 東京ガーデンテラス紀尾井町 19階、20階" | abrg -

download

Obtains the latest data from server.

$ abrg download

Downloads the public data from the address base registry "全アドレスデータ" into the $HOME/.abr-geocoder directory, then creates a local database using SQLite.

To update the local database, runs abrg download.

update-check

Checks the new update data.

$ abrg update-check

Returns 0 if new data is available in CKAN or if no local database exists. In that case, runs download command. Returns 1 if the local database is the latest.

geocode (without command is specified)

Geocodes from the <inputFile>. You can also specify - for stdin.

$ abrg <inputFile> [<outputFile>] [options]
  • <inputFile>

    • case: Specifies a query file path: Geocodes from the <inputFile>. The input file must have Japanese address each line.

      For example:

      abrg ./sample.txt
      東京都千代田区紀尾井町1-3
      東京都千代田区永田町1-10-1
      ...
      東京都千代田区永田町一丁目7番1号
    • case: Specifies -: You can also pass the input query through pipe command. - denotes stdin.

      echo "東京都千代田区紀尾井町1-3 東京ガーデンテラス紀尾井町 19階、20階" | abrg -
  • <outputFile> Specifies the file path to save the output. If you ommit, the command prints out to stdout.

    For example:

    abrg ./sample.txt ./output.json
    echo "東京都千代田区紀尾井町1-3" | abrg - ./output.json
    cat ./sample.txt | abrg - | jq
  • -f, --format

    Specifies output format. Default is json. | format | description | |---------|---------------------------------------------------| | csv |Output results in comma-separated csv format. | | json |Output results in json format. | | ndjson |Output results in NDJSON. | | geojson |Output results in GeoJSON format. | | ndgeojson |Output results in NDGeoJSON format.|

  • --fuzzy

    • Specifies the character to be used as a wildcard. Default is `?``.

    For example:

    echo "東京都町?市森野2-2-22" | abrg - --fuzzy "?"
  • -h, --help

    Displays this command usage.

Output Formats

json

[
  {
    "query": {
      "input": "東京都千代田区紀尾井町1-3"
    },
    "result": {
      "prefecture": "東京都",
      "match_level": 8,
      "city": "千代田区",
      "town": "紀尾井町",
      "town_id": "0056000",
      "lg_code": "131016",
      "other": "",
      "lat": 35.679107172,
      "lon": 139.736394597,
      "block": "1",
      "block_id": "001",
      "addr1": "3",
      "addr1_id": "003",
      "addr2": "",
      "addr2_id": ""
    }
  }
]

geojson

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          139.736394597,
          35.679107172
        ]
      },
      "properties": {
        "query": {
          "input": "東京都千代田区紀尾井町1-3"
        },
        "result": {
          "match_level": 8,
          "prefecture": "東京都",
          "city": "千代田区",
          "town": "紀尾井町",
          "town_id": "0056000",
          "lg_code": "131016",
          "other": "",
          "block": "1",
          "block_id": "001",
          "addr1": "3",
          "addr1_id": "003",
          "addr2": "",
          "addr2_id": ""
        }
      }
    }
  ]
}

Matching Levels

The level property denotes the address maching level.

| level | description | |-------|-------------| | 0 | Could not detect at all. | | 1 | Could detect only prefecture level. | | 2 | Could detect prefecture and city levels. | | 3 | Could detect prefecture, city, and a town ID. | | 7 | Could detect prefecture, city, a town ID, and street name level. | | 8 | Could detect prefecture, city, a town ID, street name, and extra information, such as suite number. |