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.
Install Boundaries.io SDK with npm
npm install --save @211-connect/boundaries.io-sdk
- You must have an API key from Rapid API
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 });
}
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 |
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. |
Parameter | Type | Description |
---|---|---|
lat |
number |
Required. Latitude |
lon |
number |
Required. Longitude |
Parameter | Type | Description |
---|---|---|
countyName |
string |
Required. County name |
stateAbbrv |
string |
Required. State abbreviation |
Parameter | Type | Description |
---|---|---|
placeName |
string |
Required. Place name |
stateAbbrv |
string |
Required. State abbreviation |
Parameter | Type | Description |
---|---|---|
lat |
number |
Required. Latitude |
lon |
number |
Required. Longitude |
If you have any feedback, please open an issue on our repo.