@whosonfirst/wof

    0.37.0 • Public • Published

    [BETA] This repo is still a work-in-progress.

    Installation

    npm i -g @whosonfirst/wof

    Dependencies

    To avoid reinventing the wheel, some code in this repo will 'shell out' to execute a common *nix command line application instead of native javascript code.

    Ideally we'd like to only depend on utilities which come standard on most *nix systems, but it might be the case that your environment lacks one or more of these programs:

    # check dependencies
    which cat find node git bzip2 gzip pv bsdtar docker
    # ubuntu
    sudo apt-get install git bzip2 gzip pv libarchive-tools docker
    
    # mac OSX
    brew install git bzip2 gzip pv libarchive docker

    CLI

    wof --help
    wof <cmd> [args]
    
    Commands:
      wof bundle   interact with tar bundles
      wof feature  misc functions for working with feature streams
      wof fs       interact with files in the filesystem
      wof git      interact with git repositories
      wof sqlite   interact with SQLite databases
    
    Options:
      --version      Show version number                                   [boolean]
      --verbose, -v  enable verbose logging               [boolean] [default: false]
      --help         Show help                                             [boolean]

    Git

    interact with git repositories

      wof git export <repo>  export features from a git repo
      wof git list <repo>    list paths in a git repo

    Supported Repository Types

    Both 'bare' and 'checkout' style clones are supported, these commands use the git archive command and so do not require the geojson files to be present in the filesystem.

    If you don't need a working copy of the files you can save disk space by using a --bare style clone.

    The following command uses only 661M of disk space, compared to 3.8G for the equivalent 'checkout' style clone which also extracts ~400k files to the filesystem.

    git clone \
      --bare \
      --depth 1 \
      --single-branch \
      --branch master \
      https://github.com/whosonfirst-data/whosonfirst-data-admin-us.git us-bare

    Git List

    list paths in a git repo

    wof git list /data/wof
    
    ... list of geojson files
    wof git list /data/wof --path data/101/914/241/101914241.geojson
    
    ... list of geojson files matching the path argument

    Git Export

    export features from a git repo

    wof git export /data/wof
    
    ... stream of geojson features
    wof git export /data/wof --path data/101/914/241/101914241.geojson
    
    ... stream of geojson features matching the path argument

    SQLite

    interact with SQLite databases

      wof sqlite export <db>  export features from a SQLite database
      wof sqlite import <db>  import features into a SQLite database

    SQLite Export

    export features from a SQLite database

    wof sqlite export wof.db
    
    ... stream of geojson features

    SQLite Import

    import features into a SQLite database

    cat 101914243.geojson | wof sqlite import --rm wof.db

    Feature Tools

    misc functions for working with feature streams

      wof feature format      reformat a feature stream
      wof feature properties  output feature properties
      wof feature stats       generate aggregate stats

    Feature Reformatting

    reformat a feature stream

    cat jsonstream | bin/whosonfirst.js feature format
    
    ... stream of minified json, one item per line
    cat jsonstream | bin/whosonfirst.js feature format --open $'[\n' --sep $'\n,\n' --close $'\n]'
    
    ... stream of minified json, with array header, footer and separator
    cat 101914243.geojson | bin/whosonfirst.js feature format --indent 2
    
    ... stream of pretty printed json

    Feature Properties

    output feature properties

    cat 101914243.geojson | bin/whosonfirst.js feature properties -p 'wof:id' -p 'wof:placetype'
    
    {"wof:id":101914243,"wof:placetype":"locality"}

    Feature Stats

    generate aggregate stats

    cat 101914243.geojson | bin/whosonfirst.js feature stats
    
    {"locality":1}

    Keywords

    none

    Install

    npm i @whosonfirst/wof

    DownloadsWeekly Downloads

    1

    Version

    0.37.0

    License

    MIT

    Unpacked Size

    108 kB

    Total Files

    79

    Last publish

    Collaborators

    • missinglink
    • orangejulius
    • pelias