0.0.5 • Published 10 years ago

nytdistricts v0.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

nytdistricts - npm module

A node.js wrapper for the New York Times Districts API.

Check out their docs here.

Installation

npm install nytdistricts

Usage

var NYTDistricts  = require('nytdistricts');

var nytdistricts = new NYTDistricts(apiKey);

nytdistricts.getDistricts(40.7115760,-73.7972060, function(err, data) {
  if (err) throw err;
  console.log(data);
});
//console output below
{ results:
   [ { district: '24',
       level: 'State Assembly',
       kml_url: 'http://graphics8.nytimes.com/packages/xml/represent/1358.xml' },
     { district: '14',
       level: 'State Senate',
       kml_url: 'http://graphics8.nytimes.com/packages/xml/represent/1398.xml' },
     { district: '24',
       level: 'City Council',
       kml_url: 'http://graphics8.nytimes.com/packages/xml/represent/1530.xml' },
     { district: '08',
       level: 'Community District',
       kml_url: 'http://graphics8.nytimes.com/packages/xml/represent/215.xml' },
     { district: 'Jamaica Hills',
       level: 'Neighborhood',
       kml_url: null },
     { district: '6',
       level: 'U.S. House',
       kml_url: 'http://graphics8.nytimes.com/packages/xml/represent/1310.xml' },
     { district: 'Queens',
       level: 'Borough',
       kml_url: 'http://graphics8.nytimes.com/packages/xml/represent/queens.xml' } ] }

If you just want to get specific districts, you can use these methods:

getCityCouncilDistrict(lat,lng, callback),

getStateSenateDistrict(lat,lng, callback),

getStateAssemblyDistrict(lat,lng, callback),

getHouseDistrict(lat,lng, callback)

see examples.js for examples.

License

MIT

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago