@conveyal/geocoder-arcgis-geojson

中文文档
0.0.3发布于 2021/08/21MITTypeScriptESM + CJS近 30 天下载 2547

Return argis geocode results as geojson

原始使用文档
文档目录10 节
  1. Examples
  2. Autocomplete
  3. Bulk
  4. Reverse
  5. search({apiKey, text, ...options})
  6. API
  7. autocomplete
  8. bulk
  9. reverse
  10. search

geocoder-arcgis-geojson

Isomorphic geocoding for reuse across our JavaScript libraries. This library is built to match the API of geocoder-arcgis in order to facilitate a quick conversion of our applications to use ESRI's geocoder. Read the ESRI docs here. Coordinates must be anything that can be parsed by lonlng.

Examples

All API methods (except autocomplete) accept the options clientId, clientSecret and forStorage. When using forStorage, the clientId and clientSecret options are required.

Autocomplete

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

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

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})

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

Table of Contents

autocomplete

index.js:94-128

Search for and address using ESRI's suggest service. This service does not return geojson, instead it returns the list of address suggestions and corresponding magicKeys

Parameters

Returns Promise A Promise that'll get resolved with the suggest result

bulk

index.js:144-195

Bulk geocode a list of addresses using ESRI's geocodeAddresses service.

Parameters

  • $0 Object
    • $0.addresses Array Can be array of strings or objects. Strings can be addresses or coordinates in the form lon,lat
    • $0.clientId string
    • $0.clientSecret string
    • $0.boundary Object?
    • $0.focusPoint Object?
    • $0.url string?

Returns Promise A Promise that'll get resolved with the bulk geocode result

reverse

index.js:210-251

Reverse geocode using ESRI's reverseGeocode service.

Parameters

  • $0 Object
    • $0.clientId string?
    • $0.clientSecret string?
    • $0.forStorage boolean Specifies whether result is inteded to be stored (optional, default false)
    • $0.point {lat: number, lon: number} Point to reverse geocode
    • $0.url string? optional URL to override ESRI reverseGeocode endpoint

Returns Promise A Promise that'll get resolved with reverse geocode result

index.js:270-324

Search for an address using ESRI's findAddressCandidates service.

Parameters

  • $0 Object
    • $0.clientId string?
    • $0.clientSecret string?
    • $0.boundary Object?
    • $0.focusPoint Object?
    • $0.forStorage boolean Specifies whether result is inteded to be stored (optional, default false)
    • $0.magicKey string? magicKey to use in searching as obtained from suggest results
    • $0.size number (optional, default 10)
    • $0.text string The address text to query for
    • $0.url string? optional URL to override ESRI reverseGeocode endpoint

Returns Promise A Promise that'll get resolved with search result

版本与发布记录

@conveyal/geocoder-arcgis-geojson 共发布 5 个版本,首次发布于 2018/02/06;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.0.3latest2021/08/215 年前
0.0.22018/02/158 年前
0.0.12018/02/068 年前
0.0.02018/02/068 年前
0.0.0-semantically-released2018/02/068 年前

关于 @conveyal/geocoder-arcgis-geojson 的常见问题

@conveyal/geocoder-arcgis-geojson 是什么?

Return argis geocode results as 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 和提交记录判断。