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

v0.2.1

Published

Builds administrative boundary datasets

Downloads

12

Readme

fences

NPM

Builds administrative boundary datasets

requirements

osmfilter

osmconvert

Ubuntu provides osmfilter and osmconvert in a package called osmctools which can be installed with

$ [sudo] apt-get install osmctools

Or you can build them as follows

$ wget -O - http://m.m.i24.cc/osmfilter.c | cc -x c - -O3 -o /usr/local/bin/osmfilter
$ wget -O - http://m.m.i24.cc/osmconvert.c | cc -x c - -lz -O3 -o /usr/local/bin/osmconvert

install

$ npm install -g fences

usage

fences [options] [command]

  Commands:

    prep [options] <inputPBF> <outputPBF>                  extract all administrative boundaries into a new pbf file
    build <inputFile> <outputDir>                          process an OSM file and generate geojson files for each admin_level of administrative boundaries
    regions <inputRegionsFile> <sanitizedRegionsFil>       Sanitize names and filter input regions file
    slice <regionsFile> <inputDir> <outputDir>             slice all geojson files in inputDir into specified regions
    create [options] <inputPBF> <regionsFile> <outputDir>  run fences creation process from start to finish (prep,build,slice)

  Options:

    -h, --help  output usage information

prep

Typically you would run prep on planet-latest.pbf before feeding it to the build script. prep will intelligently filter the input file and preserve only administrative boundary relations and all their belonging members. The original input file will not be changed. An output pbf file will be created in the specified location.

prep [options] <inputPBF> <outputPBF>

  extract all administrative boundaries into a new pbf file

  Options:

    -h, --help               output usage information
    -t, --tempDir <tempDir>  specify temp directory, defaults to /tmp/fences/

  Examples:

    $ fences prep /etc/data/planet-latest.pbf /etc/data/planet-filtered.pbf
    $ fences prep -t /tmp/otherDir /etc/data/planet-latest.pbf /etc/data/planet-filtered.pbf

build

build [options] <inputFile> <outputDir>

  process an OSM file and generate geojson files for each admin_level of administrative boundaries

  Options:

    -h, --help  output usage information

  Examples:

    $ fences build /etc/data/planet-filtered.pbf /etc/data/planet-fences/

slice

This script will generate region extracts from a given directory of geojson files. Regions to be extracted are specified in a geojson file where each feature will result in an extract directory. It's important that each feature have a property name under properties. The resulting directories will correspond to those name parameters.

slice [options] <regionsFile> <inputDir> <outputDir>

  slice all geojson files in inputDir into specified regions

  Options:

    -h, --help  output usage information

  Examples:

    $ fences slice /etc/data/regions.geojson /etc/data/planet-fences/ /etc/data/region-fences/

create

This script will run all the other steps in the correct order: prep -> build -> slice and produce region extracts of fences

create [options] <inputPBF> <regionsFile> <outputDir>

  run fences creation process from start to finish (prep,build,slice)

  Options:

    -h, --help               output usage information
    -t, --tempDir <tempDir>  specify temp directory, defaults to /tmp/fences/

  Examples:

    $ fences create /etc/data/planet-latest.pbf /etc/data/regions.json /etc/data/region-fences/

test

npm test

Build Status