2.0.5 • Published 3 years ago

amap-clawer v2.0.5

Weekly downloads
3
License
ISC
Repository
github
Last release
3 years ago

高德API

利用高德搜索Web API爬取数据。

依赖包

NPM包:

TypeScript安装:

npm install -g typescript

TypeScript支持node模块:

npm install @types/node

命令行工具

安装

使用如下命令安装:

npm install -g amap-clawer

使用方法

Key 配置文件编写

key-config 参数值即 Target 配置文件,该文件为 JSON 格式, 是一个 GaodeApiKey 接口的数组,GaodeApiKey 定义为:

interface GaodeApiKey {
    key: string;
}

例如:

[{
    "key": "您的key1"
},{
    "key": "您的key2"
}]

POI 爬虫

使用格式说明如下:

gaode-poi [options]

Required options:

-t, --target-config [string]    Set download targets.
-k, --key-config [string]       Set amap keys.
-o, --output-dir [string]       Set output root dir.

例如:

gaode-poi -t targets.json -k keys.json -o .

其中,targets.json 是 Target 配置文件, keys.json 是 Key 配置文件。

target-config 参数值即 Target 配置文件,该文件为 JSON 格式, 是一个 DownloadGaodeTarget 接口的数组,DownloadGaodeTarget 定义为:

interface DownloadGaodeTarget {
    city: string;
    types: TargetType[]
}

interface TargetType {
    name?: string;
    id?: string;
}

例如:

[{
    "city": "wuhan",
    "types": [{
        "name": "高等院校",
        "id": "141201"
    }]
}]

地理编码爬虫

使用高德地图地理编码 API 进行对地址的批量地理编码。目前仅支持 CSV 格式文件。

使用格式说明如下:

download-gaode-poi [options]

Required options:

-c, --input-csv [string]           Set input targets from csv file.
-k, --key-config [string]          Set amap keys.
-o, --output-dir [string]          Set output root dir.
-i, --field-oid [string]           Set unique id field. Default to "id".
-a, --field-address [string]       Set output address field name. Default to "address".

例如:

gaode-geocode -k keys.json  -o . -c geocode.csv -a "PLACE" -i "OID"

其中:

  • -c 参数表示需要被地理编码的地址的集合文件
  • -a 表示输入文件中表示地址的字段
  • -i 表示输入文件中表示主键的字段

与代码集成

该仓库暂时只作为命令行工具使用。与代码集成没有经过测试。

2.0.5

3 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago