GeoJSON boundaries for Earth, masterfully formatted and normalized for your consumption.
Total # as of writing this: 83,842
- Neighborhoods
- Zillow
- US States/Cities/Counties/Zip Codes
- Census Bureau (TIGER 2016)
- Canada Cities Codes
- Census Bureau (TIGER 2016)
- Countries
- Planet (earth only)
Know of more good sources for boundary data? Send a PR!
Each boundary is a GeoJSON MultiPolygon. The properties object on each geometry contains the following fields:
id
(String)- Unique ID (slug) for this boundary
type
(String)- state, neighborhood, county, planet, etc.
name
(String)- Display Name
code
(String)- FIPS code for US boundaries
- For neighborhoods, this is the Zillow ID.
- For countries this is the ISO A3 code.
- You can reference the files directly from github
- You can install it as a node module (see below)
Due to size limits on npm, you'll have to install from github.
npm install github:contra/boundaries --save
If anything was able to land on NPM, it's outdated - don't use it.
listSync()
- Synchronous
- Returns an array of boundary IDs
readSync(id)
- Synchronous
- Returns the object representing the given boundary ID
list([cb])
- Asynchronous form of
listSync
- Callback is optional, returns a promise
- Asynchronous form of
read(id[, cb])
- Asynchronous form of
readSync
- Callback is optional, returns a promise
- Asynchronous form of
Simple example of listing boundaries and reading them synchronously.
var boundaries = require('boundaries');
var fs = require('fs');
var ids = boundaries.listSync();
ids.forEach(function(id) {
var boundary = boundaries.readSync(id);
// Do something with it!
});
import { listSync, readSync } from 'boundaries'
const ids = listSync()
ids.forEach((id) => {
const boundary = readSync(id)
// Do something with it!
})
To update the results in files.json
go run main.go