@sk-global/js-msearch-gsi-jp 1.1.5 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,2 +1,82 @@
|
|
|
1
1
|
# @sk-global/js-msearch-gsi-jp
|
|
2
2
|
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
`@sk-global/js-msearch-gsi-jp` 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.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Reverse Geocoding: Convert latitude and longitude to an address.
|
|
10
|
+
- Search for a location by address: Search for a location by address.
|
|
11
|
+
|
|
12
|
+
## Supported APIs
|
|
13
|
+
|
|
14
|
+
* Geocoding API - `GET https://msearch.gsi.go.jp/address-search/AddressSearch?q=XXXX`
|
|
15
|
+
* Reverse Geocoding API - `GET https://mreversegeocoder.gsi.go.jp/reverse-geocoder/LonLatToAddress?lat=XXXX&lon=XXXX`
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
To install the library, use npm:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install @sk-global/js-msearch-gsi-jp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Ensure you have Node.js version 18.0.0 or higher.
|
|
27
|
+
|
|
28
|
+
## How to use
|
|
29
|
+
|
|
30
|
+
Import the library in your project and use the provided functions. Here is an example of how to use the latLonToAddress function:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { latLonToAddress } from '@sk-global/js-msearch-gsi-jp';
|
|
34
|
+
|
|
35
|
+
const address = await latLonToAddress(35.6895, 139.6917);
|
|
36
|
+
|
|
37
|
+
// Output:
|
|
38
|
+
// { results: { muniCd: '13104', lv01Nm: '西新宿二丁目' } }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
Example 1: Reverse Geocoding
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { latLonToAddress } from '@sk-global/js-msearch-gsi-jp';
|
|
47
|
+
|
|
48
|
+
async function getAddress() {
|
|
49
|
+
const address = await latLonToAddress(35.6895, 139.6917);
|
|
50
|
+
|
|
51
|
+
// Output:
|
|
52
|
+
// { results: { muniCd: '13104', lv01Nm: '西新宿二丁目' } }
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Example 2: Search for a location by address
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
import { searchResults } from '@sk-global/js-msearch-gsi-jp';
|
|
60
|
+
const q = '北海道';
|
|
61
|
+
const searchResults = await searchAddress(q);
|
|
62
|
+
console.log(searchResults);
|
|
63
|
+
|
|
64
|
+
// Output:
|
|
65
|
+
// [
|
|
66
|
+
// {
|
|
67
|
+
// geometry: { coordinates: [Array], type: 'Point' },
|
|
68
|
+
// type: 'Feature',
|
|
69
|
+
// properties: { addressCode: '', title: '北海道' }
|
|
70
|
+
// },
|
|
71
|
+
// {
|
|
72
|
+
// geometry: { coordinates: [Array], type: 'Point' },
|
|
73
|
+
// type: 'Feature',
|
|
74
|
+
// properties: { addressCode: '', title: '北海道' }
|
|
75
|
+
// },
|
|
76
|
+
// ...
|
|
77
|
+
// ]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
This library is released under the MIT License. For more information, see the [LICENSE](LICENSE) file.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sk-global/js-msearch-gsi-jp",
|
|
3
3
|
"description": "A client library for APIs that presented by Geospatial Information Authority of Japan",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.8",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.module.js",
|