npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fences-slicer

v0.2.7

Published

Split large geojson file into smaller region files

Downloads

3

Readme

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

preparing regions file

You can feed a geojson file through the fences-regions command to sanitize and prepare the file to be used in the fences-slicer step.

$ fences-regions --inputGeojson=/etc/planet-fences/admin_level_2.geojson --outputFile=./regions.geojson

In order for input regions to show up in output regions they must meet the following requirements:

  • have name or name:en property
  • have flag property

You could provide a wanted list of names as a filter. In that case the results will all be names matching the items in the wanted list.

Regions in output will also be simplified (to 0.001).

Output regions will each have the following properties:

  • name_display : name to be used for display purposes
  • name : sanitized version of the name that can be used for filenames

standalone utility

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

| Name | Description | | :---- | :----------- | |inputDir | path 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. | |outputDir| path to an existing directory that will contain output files after the slicer is done slicing. | |regionFile | Geojson file containing regions to be used when slicing. Each region feature must have a name in properties. |

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",
  "regionFile": "/some/geojson/file..geojson"
}

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 param = {
  inputDir: '/some/dir/planet-fences/',
  inputFile: 'planet-level-2.geojson',
  outputDir: '/some/dir/to/throw/output/',
  regionFile: '/etc/my/regions.geojson'
};

slicer.extractRegions(params, function () {
  console.log('fences sliced successfully!');
});

coverage

$ npm run coverage

test

$ npm test

Build Status