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

v2.1.1

Published

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

Downloads

545

Readme

abr-geocoder (Digital Agency Address Base Registry Geocoder)

🚨 Upgrade to version 2.1 from v2.0

  • Due to the significant changes for the database structure, removes the database directory (default: ~/.abr-geocoder), then runs the abrg download command.

Description

A geocoder that matches input address strings with the Address Base Registry maintained by the Digital Agency, Government of Japan, outputting normalized address strings, town IDs, latitude and longitude, etc. It analyzes Japanese domestic address notation, absorbs variations, and outputs normalized results according to the hierarchy.

Image

Features

  • Geocoder targeting domestic addresses in Japan.
  • Normalizes address notation according to the Address Base Registry and hierarchy.
  • Supports residence indication and partial number (lot number).
  • Uses SQLite, enabling geocoding within the server.
  • High-speed processing through multithreading.
  • Supports six output formats: csv, json, geojson, ndjson, ndgeojson, simplified.

Use Cases

  • Usable as a command:
    • Pipeline with standard input/output.
    • Input/output via file.
  • Usable as a REST server.
  • Usable as a Node.js library:
    • Supports individual requests and streams.
  • Limited support for searches by Kyoto street names.

Limitations

  • Cannot search by landmarks (e.g., famous facility names).
  • Cannot search by postal codes.
  • Cannot search by alphabet (English notation).

Installation

  • Global installation

    npm install -g @digital-go-jp/abr-geocoder
    abrg  # Verify it runs
  • Local install

    npm install @digital-go-jp/abr-geocoder
    npm link
    abrg  # Verify it runs

abrg download command

Downloads the necessary dataset for geocoding from the Address Base Registry and builds the database using SQLite.

abrg download [options]
  • You can specify a particular prefecture or municipality to build a localized database, reducing the data size and speeding up database construction.

    Use the National Local Government Codes to specify the region(s). Separate multiple regions with spaces.

    # Download data for Tokyo
    abrg download -c 130001
    
    # Download data for Tokyo and Kanagawa
    abrg download -c 130001 140007
    
    # Download data for Chiyoda ward
    abrg download -c 131016
  • You can change the directory to download the dataset files and save the database. The default is $HOME/.abr-geocoder.

    abrg download -d (path to directory to save data)
  • abrg download --silent
  • abrg download --debug

abrg update-check command

Checks for data updates. If there is local data, it checks for updates in the municipalities contained in the database. If new data is available, it can be downloaded.

abrg update-check [options]
  • # Continue downloading
    abrg update-check --yes
    
    # Do not continue downloading
    abrg update-check --no
  • abrg update-check --silent
  • Specifies the directory to save the database. The default is $HOME/.abr-geocoder.

    abrg update-check -d (path to directory to save data)
  • abrg update-check --debug

abrg command

Geocodes the input address string with the database and outputs normalized address strings, town IDs, latitude, longitude, etc.

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

    Specifies how to input data into the command.

    • Example:

      abrg ./sample.txt

      sample.txt:

      東京都千代田区紀尾井町1-3   // 1-3 Kioicho, Chiyoda-ku, Tokyo
      東京都千代田区永田町1-10-1  // 1-10-1 Nagatacho, Chiyoda-ku, Tokyo
      ...
      東京都千代田区永田町一丁目7番1号  // 1-7-1 Nagatacho, Chiyoda-ku, Tokyo
    • Example:

      echo "東京都千代田区紀尾井町1-3 東京ガーデンテラス紀尾井町 19階、20階" | abrg -
  • <outputFile>

    Specifies where to output the processing results. If omitted, outputs to standard output (stdout).

    • Example:

      abrg ./input.txt ./output.json
    • Example:

      cat ./sample.txt | abrg - | jq
  • You can change the output format with the -f, --format option. The default is json.

    | format | Description | |------------|---------------------------------------------------------------| | csv | Outputs results in comma-separated csv format | | simplified | Outputs results in comma-separated csv format with limited fields | | json | Outputs results in JSON format | | ndjson | Outputs results in NDJSON format | | geojson | Outputs results in GeoJSON format | | ndgeojson | Outputs results in NDGeoJSON format |

  • Example:

    echo "東京都町●市森野2-2-22" | abrg - --fuzzy "●"
  • abrg ./input.txt ./output.txt --silent
  • Specifies the directory to save the database. The default is $HOME/.abr-geocoder.

    abrg ./input.txt ./output.txt  -d (path to directory to save data)
  • abrg ./input.txt ./output.txt --debug
  • You can change the geocoding target with the --target option. The default is all.

    | format | Description | |-------------|----------------------------------------------------------------------------------------------------------------------| | all | Searches both residential address and parcel number data. The result for the residential address takes precedence. | | residential | Searches only the residential address data. | | parcel | Searches only the parcel number data. |

abrg serve command

Starts the geocoder as a REST API server.

abrg serve [options]

Example:

curl http://localhost:3000/geocode?address=東京都千代田区紀尾井町1-3
  • Changes the port number for the REST API server. The default is 3000.

    abrg serve -p 8080
  • Specifies the directory to save the database. The default is $HOME/.abr-geocoder.

    abrg serve  -d (path to directory to save data)
  • The request is made via HTTP/GET. The following parameters can be specified:

    | Parameter | Required | Description | |-------------|-------------------------------------------------------------------| | address | Y | The address string to be geocoded. Required parameter. | | target | | Search target (all, residential, parcel) | | format | | Output format for the result. | | fuzzy | | A single character used as a wildcard. |