state-polygon

1.0.3 • Public • Published

statepolygon

##Only US and canada states are supported.

Methods: 1). stateNamesToAbbreviations - converts state names to abbreviations. 2). statePolygonFromAbb - gets state outline polygon from state abbreviations. 3). statePolygonFromNames - gets state outline polygon from state names.

Note: Input to all these methods can be string or array of string

##Sample Usage

import { statePolygonFromAbb } from 'statepolygon'

const stateAbb = statepolygon.fromStateAbbreviations(['California', 'new york']);

console.log('reqStatePoly :: ', reqStatePoly); // ['CA', 'NY']
import { statePolygonFromNames } from 'statepolygon'

const reqStatePoly = statePolygonFromNames(['California', 'new york']);

console.log('reqStatePoly :: ', reqStatePoly);
import { statePolygonFromAbb } from 'statepolygon'

const reqStatePoly = statePolygonFromAbb(['California', 'new york']);

console.log('reqStatePoly :: ', reqStatePoly);
import { allPolygon } from 'statepolygon'

const allStatesPolygon = allPolygon();

console.log('reqStatePoly :: ', allStatesPolygon); // Array of all states poygon

Package Sidebar

Install

npm i state-polygon

Weekly Downloads

207

Version

1.0.3

License

ISC

Last publish

Collaborators

  • msdhanju