New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@sk-global/open-reverse-geocoder

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sk-global/open-reverse-geocoder

Reverse Geocoder, a library for reverse geocoding based on the Geospatial Information Authority of Japan (GSI) data

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
0
Created
Source

@sk-global/open-reverse-geocoder

Introduction

@sk-global/open-reverse-geocoder is a client library for APIs presented by the Geospatial Information Authority of Japan. This library provides functionalities to interact with various geospatial data services.

Features

  • Reverse Geocoding: Convert latitude and longitude to an address.
  • Search for a location by address: Search for a location by address.

Supported APIs

  • Geocoding API - GET https://msearch.gsi.go.jp/address-search/AddressSearch?q=XXXX
  • Reverse Geocoding API - GET https://mreversegeocoder.gsi.go.jp/reverse-geocoder/LonLatToAddress?lat=XXXX&lon=XXXX

Installation

To install the library, use npm:

npm install @sk-global/open-reverse-geocoder

Ensure you have Node.js version 18.0.0 or higher.

How to use

Import the library in your project and use the provided functions. Here is an example of how to use the openReverseGeocoder function:

import { openReverseGeocoder } from '@sk-global/open-reverse-geocoder';

const lnglat = [139.6917, 35.6895];
const address = await openReverseGeocoder(lnglat);

console.log(address);
// Output:
// { code: '13101', city: 'Chiyoda-ku' }

Examples

Example 1: Reverse Geocoding

import { openReverseGeocoder } from '@sk-global/open-reverse-geocoder';

async function getAddress() {
  const lnglat = [139.6917, 35.6895];
  const address = await openReverseGeocoder(lnglat);

  console.log(address);
  // Output:
  // { code: '13101', city: 'Chiyoda-ku' }
}

getAddress();

Example 2: Search for a location by address

import { searchAddress } from '@sk-global/open-reverse-geocoder';

async function searchLocation() {
  const q = '北海道';
  const searchResults = await searchAddress(q);
  console.log(searchResults);

  // Output:
  // [
  //   {
  //     geometry: { coordinates: [Array], type: 'Point' },
  //     type: 'Feature',
  //     properties: { addressCode: '', title: '北海道' }
  //   },
  //   ...
  // ]
}

searchLocation();

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Package last updated on 07 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts