🚨 Shai-Hulud Strikes Again:More than 700 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

boundaries

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boundaries

Source for all GeoJSON boundaries on Earth

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

boundaries NPM version Downloads

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 boundaries

API

  • 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
  • read(path[, cb])
    • Asynchronous form of readSync
    • Callback is optional, returns a promise

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!
})

Keywords

geojson

FAQs

Package last updated on 24 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts