# @conveyal/geocoder-arcgis-geojson 中文文档

规范地址：https://npmcn.com/package/%40conveyal/geocoder-arcgis-geojson/

版本：0\.0\.3
npm 元数据更新时间：2022-06-12T16:38:57.710Z
中文译文更新时间：2026-11-10T22:28:25.496Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40conveyal/geocoder-arcgis-geojson
原文对照：https://npmcn.com/package/%40conveyal/geocoder-arcgis-geojson/?lang=original
项目主页：https://github.com/conveyal/geocoder-arcgis-geojson
源码仓库：https://github.com/conveyal/geocoder-arcgis-geojson

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：99.9 kB，12 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：3 个
- 首次发布：2018-02-05T22:21:46.896Z
- 最新版本发布：2021-08-20T19:52:13.856Z
- 近 30 天下载量：2547（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：5（近 12 个月 0 个）

## 中文简介

返回 argis 地理编码结果为 Geojson

## 安装

```sh
npm install @conveyal/geocoder-arcgis-geojson
```

也可以使用：`pnpm add @conveyal/geocoder-arcgis-geojson`、`yarn add @conveyal/geocoder-arcgis-geojson`、`bun add @conveyal/geocoder-arcgis-geojson`

## README

# 地编码器-arcgis-geojson

我们的JavaScript库的重复使用的Isomorphic地理编码. 此库的构建是为了匹配 [地理编码-arcgis](https://www.npmjs.com/package/geocoder-arcgis) 以便快速转换我们的应用 使用ESRI的地理编码器。 读取 ESRI 文件 [这里](https://developers.arcgis.com/labs/rest/get-an-access-token/)。坐标必须是任何可以由 [龙龙](https://github.com/conveyal/lonlng)。 。 。 .

-   [实例](https://npmcn.com/package/%40conveyal/geocoder-arcgis-geojson/#readme-examples)
-   [API 文档](https://npmcn.com/package/%40conveyal/geocoder-arcgis-geojson/#readme-api)

## 实例

所有 API 方法( 自动完成除外) 接受选项 `clientId`, (中文(简体) ), `clientSecret` 财务报告和审定财务报表 `forStorage`时 `forStorage`,则 `clientId` 财务报告和审定财务报表 `clientSecret` 需要选项.

### `Autocomplete`

```js
import {autocomplete} from 'geocoder-arcgis-geojson'

autocomplete({
  boundary: {
    rect: {
      minLon: minLon,
      minLat: minLat,
      maxLon: maxLon,
      maxLat: maxLat
    }
  },
  focusPoint: {lat: 39.7691, lon: -86.1570},
  text: '1301 U Str'
}).then((result) => {
  console.log(result)
}).catch((err) => {
  console.error(err)
})
```

### `Bulk`

```js
import {autocomplete} from 'geocoder-arcgis-geojson'

bulk({
  addresses: [
    '1301 U Str',
    '123 Main St'
  ],
  boundary: {
    rect: {
      minLon: minLon,
      minLat: minLat,
      maxLon: maxLon,
      maxLat: maxLat
    }
  },
  clientId: 'secret',
  clientSecret: 'secret',
  focusPoint: {lat: 39.7691, lon: -86.1570}
}).then((result) => {
  console.log(result)
}).catch((err) => {
  console.error(err)
})
```

### `Reverse`

```js
import {reverse} from 'geocoder-arcgis-geojson'

reverse({
  point: {
    lat: 39.7691,
    lng: -86.1570
  }
}).then((result) => {
  console.log(result)
}).catch((err) => {
  console.error(err)
})
```

### `search({apiKey, text, ...options})`

```js
import {search} from 'geocoder-arcgis-geojson'

search({
  text: '1301 U Street NW, Washington, DC',
  focusPoint: {lat: 39.7691, lon: -86.1570},
  boundary: {
    rect: {
      minLon: minLon,
      minLat: minLat,
      maxLon: maxLon,
      maxLat: maxLat
    }
  }
}).then((geojson) => {
  console.log(geojson)
}).catch((err) => {
  console.error(err)
})
```

## API 密码

#### 目录

-   [自动补全](https://npmcn.com/package/%40conveyal/geocoder-arcgis-geojson/#readme-autocomplete)
-   [批量](https://npmcn.com/package/%40conveyal/geocoder-arcgis-geojson/#readme-bulk)
-   [倒转](https://npmcn.com/package/%40conveyal/geocoder-arcgis-geojson/#readme-reverse)
-   [搜索](https://npmcn.com/package/%40conveyal/geocoder-arcgis-geojson/#readme-search)

### 自动补全

[指数.js:94-128](https://github.com/conveyal/geocoder-arcgis-geojson/blob/c4b5701a0403d4a80761b1528624bd7795e0dcfd/index.js#L94-L128 "Source code on GitHub")

使用 爱斯理的 [建议](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) 服务。 此服务不返回 Geijson , 而是返回列表 地址建议和相应的魔法钥匙

**参数**

-   `$0` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
    -   `$0.clientId` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?**
    -   `$0.clientSecret` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?**
    -   `$0.boundary` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)? 吗?**
    -   `$0.focusPoint` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)? 吗?**
    -   `$0.text` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 查询文本
    -   `$0.url` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?** 覆盖 ESRI 的可选 URL 建议终点

回返 **[答应](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** 保证能以建议的结果解决

### 批量

[指数.js:144-195](https://github.com/conveyal/geocoder-arcgis-geojson/blob/c4b5701a0403d4a80761b1528624bd7795e0dcfd/index.js#L144-L195 "Source code on GitHub")

使用 : 爱斯理的 [地理编码地址](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) 服务.

**参数**

-   `$0` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
    -   `$0.addresses` **[阵列](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** 可以是字符串或对象的数组。 字符串可以是表单中的地址或坐标 `lon,lat`
    -   `$0.clientId` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
    -   `$0.clientSecret` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
    -   `$0.boundary` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)? 吗?**
    -   `$0.focusPoint` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)? 吗?**
    -   `$0.url` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?**

回返 **[答应](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** 保证用大块地码结果解决

### 倒转

[指数.js:210-251](https://github.com/conveyal/geocoder-arcgis-geojson/blob/c4b5701a0403d4a80761b1528624bd7795e0dcfd/index.js#L210-L251 "Source code on GitHub")

使用 爱斯理的 [倒转吉奥码](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm) 服务.

**参数**

-   `$0` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
    -   `$0.clientId` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?**
    -   `$0.clientSecret` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?**
    -   `$0.forStorage` **[布尔](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 指定是否要存储结果( 可选, 默认) `false`(中文(简体) )
    -   `$0.point` **{lat: [编号](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number),龙: [编号](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number){\\fn黑体\\fs22\\bord1\\shad0\\3aHBE\\4aH00\\fscx67\\fscy66\\2cHFFFFFF\\3cH808080}你觉得呢** 倒转地理代码的点
    -   `$0.url` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?** 可选 URL 以覆盖 ESRI 逆向Geocode 端点

回返 **[答应](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** 以反向地理码结果解决的承诺

### 搜索

[指数.js:270-324](https://github.com/conveyal/geocoder-arcgis-geojson/blob/c4b5701a0403d4a80761b1528624bd7795e0dcfd/index.js#L270-L324 "Source code on GitHub")

使用 爱斯理的 [寻找地址](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm) 服务.

**参数**

-   `$0` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
    -   `$0.clientId` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?**
    -   `$0.clientSecret` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?**
    -   `$0.boundary` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)? 吗?**
    -   `$0.focusPoint` **[对象](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)? 吗?**
    -   `$0.forStorage` **[布尔](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 指定是否要存储结果( 可选, 默认) `false`(中文(简体) )
    -   `$0.magicKey` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?** 用于搜索的从 `suggest` 结果
    -   `$0.size` **[编号](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** (可选,默认) `10`(中文(简体) )
    -   `$0.text` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要查询的地址文本
    -   `$0.url` **[字符串](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)? 吗?** 可选 URL 以覆盖 ESRI 逆向Geocode 端点

回返 **[答应](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** 保证通过搜索结果解决

## 常见问题

### @conveyal/geocoder-arcgis-geojson 是什么？

返回 argis 地理编码结果为 Geojson

### 如何安装 @conveyal/geocoder-arcgis-geojson？

在项目目录运行 npm install @conveyal/geocoder-arcgis-geojson，或使用 pnpm add / yarn add / bun add。

### @conveyal/geocoder-arcgis-geojson 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @conveyal/geocoder-arcgis-geojson 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @conveyal/geocoder-arcgis-geojson 可以商用吗？

@conveyal/geocoder-arcgis-geojson 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @conveyal/geocoder-arcgis-geojson 的下载量有多少？

根据 npm 官方下载统计，@conveyal/geocoder-arcgis-geojson 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,547 次，日均约 85 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @conveyal/geocoder-arcgis-geojson 还在维护吗？

最新版本 0\.0\.3 发布于 2021/08/21（5 年前）；至今共发布 5 个版本，其中过去 12 个月发布了 0 个；首次发布于 2018/02/06。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

