1.0.0 • Published 8 years ago

brazilian-boundaries v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Table of Contents

Installation

$ npm install --save brazilian-boundaries

Usage

There are three ways of using this data:

  • Use the NPM module to retrieve and access the data (instructions below)
  • Use this repo as a submodule and write your own thing to load the data (just a bunch of json files!)
  • Link directly to the files on GitHub

API

import { list, read } from 'brazilian-boundaries'

const files = await list()

files.forEach((filePath) => {
  const boundary = await read(filePath)
  // Your magic goes here...
})

Let's say we want to get geojson data for the state of Ceará:

import { read } from 'brazilian-boundaries'

read('path/to/brazil-boundaries/repos/brazilian-boundaries/files/CE.json')
    .then(
        (data) =>
           console.log(data))

If we test our console output on any .geojson linter–e.g. geojson.io–we should get something like:

list([cb])

Returns a promise which will handle an array of boundary file paths.

Callback is optional.

read(path[, cb])

Returns a promise which will handle the boundary for the given path.

Callback is optional.

CLI

Coming soon!

Development

All the tasks needed for development automation are defined in the package.json scripts property and can be run via:

npm run <command>

Here is a summary of all the commands:

CommandDescription
buildRuns babel.js.
lintRuns eslint.
testRuns unit tests.
updateFetches more recent data.

License

brazilian-boundaries is distributed under the MIT License, available in this repository. All contributions are assumed to be also licensed under the MIT License.

Credits