JSPM

state-polygon

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 353
  • Score
    100M100P100Q115818F
  • License ISC

US and canada state polygon - state outline

Package Exports

  • state-polygon

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (state-polygon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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