# simpletileclient

> 国土地理院などが配布しているタイル形式の配布物を比較的簡単に取得するためのライブラリです。 内部に Axios を搭載してます。

Latest version **1.0.3** (published 2021-08-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install simpletileclient
pnpm add simpletileclient
yarn add simpletileclient
bun add simpletileclient
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2021-08-15 |
| First published | 2021-08-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | inaridiy |

## Links

- npm: https://www.npmjs.com/package/simpletileclient
- npm.io page: https://npm.io/package/simpletileclient

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.21.1

## Recent versions

- 1.0.3 (latest) — 2021-08-15
- 1.0.2 — 2021-08-15
- 1.0.1 — 2021-08-14
- 1.0.0 — 2021-08-14

## README

# めっちゃシンプルなタイルクライアント

国土地理院などが配布しているタイル形式の配布物を比較的簡単に取得するためのライブラリです。  
内部に Axios を搭載してます。

# 使用例

```ts
import { SimpleClient } from "simpletileclient";

const client = new SimpleClient(
  "https://cyberjapandata.gsi.go.jp/xyz/experimental_rdcl/{z}/{x}/{y}.geojson"
);

client
  .get(16, 57442, 26004)
  .then((tile) => console.log(tile))
  .catch((e) => console.error(e));
```

# API

## Constructor

---

**new SimpleClient(url: string, reqOpt?: AxiosRequestConfig)** —タイルを取得するクライアントを作成する。  
`url`には`{z},{x},{y}`の三つがそれぞれ含まれている必要がある。  
画像や Pbf 形式のものなどは`reqOpt.responseType`と`reqOpt.headers`などを設定しないとデータを正しく取得できない。  
また、`url`を設定せずに`reqOpt.baseURL`で設定すると正しく取得できない。

## Method

---

**get(zoom: number, x: number, y: number)=>Promise<AxiosResponse>** —  
インスタンスを作成したときに指定した URL の `{z},{x},{y}`をそれぞれ置き換えて axios の get メソッドを使用し、  
レスポンスを返す。

**getByRect(zoom: number, cx: number, cy: number, width: number, height: number)=>Promise<AxiosResponse[]>** —  
`cx`,`cy`を中心として幅`width`,高さ`height`の範囲のタイルを全取得し、それぞれを配列にして返します

---
_Source: https://npm.io/package/simpletileclient · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
