Socket
Socket
Sign inDemoInstall

fences-slicer

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fences-slicer

Split large geojson file into smaller region files


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

fences-slicer

Split large geojson file into smaller region files

NPM

install

Note: you will need node and npm installed first. The easiest way to install node.js is with nave.sh by executing [sudo] ./nave.sh usemain stable

npm install fences-slicer

usage

standalone utility

When using fences-slicer from the command line, it expects the following config parameters in order to do its job.

NameDescription
inputDirpath to the directory containing geojson input files that need to be split into regions. Only GEOJSON files will be processed, all others will be skipped. Input files will not be modified.
outputDirpath to an existing directory that will contain output files after the slicer is done slicing.
regionsJSON array of regions to extract out of the input files. Each region object must contain name and box properties. See sample config file for details.

The expected parameters can be specified via a config file like so:

$ fences-slicer --config=./etc/config.json

sample config file contents
{
  "inputDir": "/some/dir/planet-latest-fences",
  "outputDir": "/some/dir/planet-latest-fences-regions",
  "regions": [
    {
      "name": "USA",
      "box": {
        "left": -124.848974,
        "bottom": 24.396308
        "right": -66.885444,
        "top": 49.384358
      }
    }
  ]
}

If not using a config file, or using a config file but need to override a particular parameter do this:

$ fences-slicer --inputDir=/path/different/from/config --config=./etc/config.json

dependency module

When using fences-slicer in your node.js package as dependency, you need to provide an input file and an array of regions, where each region has an output file and box. See example below.

var slicer = require('fences-slicer');

var inputFile = '/some/dir/planet-fences/planet-level-2.geojson';

var regions = [{
  outputFile: '/some/dir/USA-fences/USA-level-2.geojson',
  box: {
    left: -124.848974,
    bottom: 24.396308
    right: -66.885444,
    top: 49.384358
  }
}];

slicer.extractRegions(inputFile, regions, function (exitCode) {
  console.log('hello fence slices!');
});

coverage

$ npm run coverage

test

$ npm test

Build Status

Keywords

FAQs

Package last updated on 22 May 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc