@211-connect/boundaries.io-sdk 中文文档教程

发布于 3年前 浏览 21 项目主页 更新于 3年前

Boundaries.io SDK

boundaries.io 是一个易于使用的 HTTP api,允许您以 GeoJSON 格式检索地理多边形。 此包不隶属于 boundaries.io,是一个正在进行的项目,旨在将 boundaries.io 中的所有端点引入一个简单的 sdk。

Installation

使用 npm 安装 Boundaries.io SDK

  npm install --save @211-connect/boundaries.io-sdk

Prerequisites

Usage/Examples

var Client = require('@211-connect/boundaries.io-sdk');

var boundaries = new Client({ apiKey: 'YOUR-BOUNDARIES.IO-API-KEY' });

async function getZipCodes() {
  // Pass in an array of zip codes
  await boundaries.queryByZipCodes(['98908', '98903', '98902'], {
    combine: true,
  });

  // Alternatively you can pass in a comma delimited list of zip codes
  await boundaries.queryByZipCodes('98908,98903,98902', { combine: true });
}

API Reference

Client

客户端构造函数采用具有以下属性的对象

Property Type Description
apiKey string Required. API key from Rapid API
apiHost string Optional. This can be ignored in most cases, however it is exposed in case the RapidAPI host changes prior to us being able to update this package
baseUrl string Optional. This can be ignored in most cases, however it is exposed in case the RapidAPI base url changes prior to us being able to update this package

queryByZipCodes(zipCodes, options)

Parameter Type Description
zipCodes string or array Required. A comma delimited list of zip codes, or an array of zip codes
options object Optional. See table below
Property Type Description
city string Optional.
state string Optional.
county string Optional.
showCenter boolean Optional.
combine boolean Optional.
showDetails boolean Optional.
and boolean Optional.

queryCountyByLatLon(lat, lon)

Parameter Type Description
lat number Required. Latitude
lon number Required. Longitude

queryCountyByName(countyName, stateAbbrv)

Parameter Type Description
countyName string Required. County name
stateAbbrv string Required. State abbreviation

queryPlaceByName(placeName, stateAbbrv)

Parameter Type Description
placeName string Required. Place name
stateAbbrv string Required. State abbreviation

queryPlaceByLatLon(lat, lon)

Parameter Type Description
lat number Required. Latitude
lon number Required. Longitude

Feedback

如果您有任何反馈,请在我们的 repo

Authors

License

麻省理工学院

Boundaries.io SDK

boundaries.io is an easy to use HTTP api that allows you to retrieve geography polygons in GeoJSON format. This package is not affiliated with boundaries.io and is an ongoing project to bring all endpoints from boundaries.io in to a simple sdk.

MIT License

Installation

Install Boundaries.io SDK with npm

  npm install --save @211-connect/boundaries.io-sdk

Prerequisites

Usage/Examples

var Client = require('@211-connect/boundaries.io-sdk');

var boundaries = new Client({ apiKey: 'YOUR-BOUNDARIES.IO-API-KEY' });

async function getZipCodes() {
  // Pass in an array of zip codes
  await boundaries.queryByZipCodes(['98908', '98903', '98902'], {
    combine: true,
  });

  // Alternatively you can pass in a comma delimited list of zip codes
  await boundaries.queryByZipCodes('98908,98903,98902', { combine: true });
}

API Reference

Client

Client constructor takes an object with the following properties

Property Type Description
apiKey string Required. API key from Rapid API
apiHost string Optional. This can be ignored in most cases, however it is exposed in case the RapidAPI host changes prior to us being able to update this package
baseUrl string Optional. This can be ignored in most cases, however it is exposed in case the RapidAPI base url changes prior to us being able to update this package

queryByZipCodes(zipCodes, options)

Parameter Type Description
zipCodes string or array Required. A comma delimited list of zip codes, or an array of zip codes
options object Optional. See table below
Property Type Description
city string Optional.
state string Optional.
county string Optional.
showCenter boolean Optional.
combine boolean Optional.
showDetails boolean Optional.
and boolean Optional.

queryCountyByLatLon(lat, lon)

Parameter Type Description
lat number Required. Latitude
lon number Required. Longitude

queryCountyByName(countyName, stateAbbrv)

Parameter Type Description
countyName string Required. County name
stateAbbrv string Required. State abbreviation

queryPlaceByName(placeName, stateAbbrv)

Parameter Type Description
placeName string Required. Place name
stateAbbrv string Required. State abbreviation

queryPlaceByLatLon(lat, lon)

Parameter Type Description
lat number Required. Latitude
lon number Required. Longitude

Feedback

If you have any feedback, please open an issue on our repo.

Authors

License

MIT

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文