1.0.2 • Published 9 years ago
boundaries v1.0.2
boundaries

GeoJSON boundaries for Earth, masterfully formatted and normalized for your consumption.
Total # as of writing this: 40,106
Usage
- 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
Using one of these methods, the boundaries are accessible on any language or platform. Enjoy!
Sources
- Neighborhoods
- Zillow
- States/Cities/Counties/Zip Codes
- US Census Bureau (TIGER 2016)
Mostly US boundaries right now (data availability), but would love to add more around the world. Know of more good sources for boundary data? Send a PR!
Boundary JSON Format
id(String)- Unique ID for this boundary
type(String)- state, neighborhood, county, etc.
name(String)- Display Name
area(Object)- GeoJSON MultiPolygon
- No simplification, original precision
Node Modules
Install
npm install boundariesAPI
listSync()- Synchronous
- Returns an array of boundary file paths
readSync(path)- Synchronous
- Returns a object representing the boundary for the given path
list([cb])- Asynchronous form of
listSync - Callback is optional, returns a promise
- Asynchronous form of
read(path[, cb])- Asynchronous form of
readSync - Callback is optional, returns a promise
- Asynchronous form of
Example
Simple example of listing boundaries and reading them synchronously.
ES5
var boundaries = require('boundaries');
var fs = require('fs');
var files = boundaries.listSync();
files.forEach(function(filePath) {
var boundary = boundaries.readSync(filePath);
// Do something with it!
});ES6
import { listSync, readSync } from 'boundaries'
const files = listSync()
files.forEach((filePath) => {
const boundary = readSync(filePath)
// Do something with it!
})