0.0.1 • Published 3 years ago

@211-connect/boundaries.io-sdk v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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)

ParameterTypeDescription
zipCodesstring or arrayRequired. A comma delimited list of zip codes, or an array of zip codes
optionsobjectOptional. See table below
PropertyTypeDescription
citystringOptional.
statestringOptional.
countystringOptional.
showCenterbooleanOptional.
combinebooleanOptional.
showDetailsbooleanOptional.
andbooleanOptional.

queryCountyByLatLon(lat, lon)

ParameterTypeDescription
latnumberRequired. Latitude
lonnumberRequired. Longitude

queryCountyByName(countyName, stateAbbrv)

ParameterTypeDescription
countyNamestringRequired. County name
stateAbbrvstringRequired. State abbreviation

queryPlaceByName(placeName, stateAbbrv)

ParameterTypeDescription
placeNamestringRequired. Place name
stateAbbrvstringRequired. State abbreviation

queryPlaceByLatLon(lat, lon)

ParameterTypeDescription
latnumberRequired. Latitude
lonnumberRequired. Longitude

Feedback

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

Authors

License

MIT