https://github.com/ythecombinator/brazilian-boundaries
🗺️ Municipal boundaries of all Brazilian cities.
https://github.com/ythecombinator/brazilian-boundaries
Last synced: 9 months ago
JSON representation
🗺️ Municipal boundaries of all Brazilian cities.
- Host: GitHub
- URL: https://github.com/ythecombinator/brazilian-boundaries
- Owner: ythecombinator
- License: mit
- Created: 2017-01-25T08:47:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-26T07:49:38.000Z (over 9 years ago)
- Last Synced: 2024-10-07T09:08:55.167Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 10.9 MB
- Stars: 11
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: .github/contributing.md
- License: LICENSE.md
Awesome Lists containing this project
README
Municipal boundaries of all Brazilian cities.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
- [Development](#development)
- [Contributing](#contributing)
- [License](#license)
- [Credits](#credits)
## Installation
```sh
$ 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
```js
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á*:
```js
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](http://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`](package.json) *scripts* property and can be run via:
`npm run `
Here is a summary of all the commands:
| **Command** | **Description** |
|-------------|---------------------------|
| `build` | Runs *babel.js*. |
| `lint` | Runs *eslint*. |
| `test` | Runs unit tests. |
| `update` | Fetches more recent data. |
## License
[brazilian-boundaries](https://github.com/ythecombinator/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
- Fetched data comes from [Luiz Pedone's *municipal-brazilian-geodata*](https://github.com/luizpedone/municipal-brazilian-geodata)
- Inspired by [contras's *boundaries*](https://github.com/contra/boundaries)