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

geohash-cli

v1.0.3

Published

CLI to find as much info as possible about today's (or any date's) geohashes.

Downloads

13

Readme

geohash-cli

CLI tool to find as much info as possible about today's (or any date's) geohashes.

I use this for xkcd Geohashing.

NPM Build Status js-standard-style Greenkeeper badge

Install

npm install geohash-cli -g

Dependencies

In order to get your location (on OS X) you will need to install whereami. One way to do this is through Homebrew. You can run

brew install whereami

Otherwise visit the whereami repo for additional installation instructions.

What it does

This module aims to be pretty specialized compared to the other modules below, and generate some quick information about the geohashes. I'm happy to take suggestions for other things it could do!

Currently it will:

  • Find your current location if the argument is not passed in and you are on OS X
  • Get the 9 closest geohashes to your location for each day
  • Get the global geohash for each day
  • Display tables for the distances from each
  • Open Google static maps for each
  • Output the information as JSON (the structure of the data is subject to change, but I'll semver it)

CLI Usage

geohash --date=2015-05-05 --days=3 --json --table --pretty

# This will output the table and json information for the current location
# for May 5th, 6th and 7th

{
  # Your current location or from the argument you passed in
  location: {latitude, longitude}
  # Hash of each date with data
  dates: {
    "2015-05-05": {
      map,
      globalMap,
      global: {distance, latitude, longitude},
      geohashes: [
        # The 9 closest geohashes. Order by index:
        # ----------------------------------
        # |          |          |          |
        # |     0    |     1    |     2    |
        # |          |          |          |
        # |          |          |          |
        # ----------------------------------
        # |          |          |          |
        # |     5    |     4    |     3    |
        # |          |  (home)  |          |
        # |          |          |          |
        # ----------------------------------
        # |          |          |          |
        # |     6    |     7    |     8    |
        # |          |          |          |
        # |          |          |          |
        # ----------------------------------
        {distance, latitude, longitude},
        {distance, latitude, longitude},
        ...
      ]
    },
    "2015-05-06": {...},
    "2015-05-07": {...}
  }
}

┌────────────┬───────────┬────────┐
│ 2015-05-05 │ Distances │ Miles  │
├────────────┼───────────┼────────┤
│            │           │        │
├────────────┼───────────┼────────┤
│ 113.89     │ 111.45    │ 135.23 │
├────────────┼───────────┼────────┤
│ 89.99      │ 46.45     │ 52.10  │
├────────────┼───────────┼────────┤
│ 44.32      │ 37.43     │ 86.09  │
├────────────┼───────────┼────────┤
│            │           │        │
├────────────┼───────────┼────────┤
│ Global     │ 7710.40   │        │
└────────────┴───────────┴────────┘
┌────────────┬───────────┬────────┐
│ 2015-05-06 │ Distances │ Miles  │
├────────────┼───────────┼────────┤
│   .......  │           │        │
└────────────┴───────────┴────────┘
┌────────────┬───────────┬────────┐
│ 2015-05-07 │ Distances │ Miles  │
├────────────┼───────────┼────────┤
│   .......  │           │        │
└────────────┴───────────┴────────┘

Node Usage

This module is setup to mainly be used from the command line, but it is possible to use it from Node if that's what you want to do.

But really it's main purpose is the CLI, so if you are just trying to do something with the JSON information I would suggest you use geohash-coordinates which does most of the heavy lifting for this module.

The same data options from below can be passed in the function.

import geohash from 'geohash-cli'

geohash({date, days, location, cache, key}, (err, results) => {
  // Results will be the same as the json information outputted from the CLI
  console.log(results)
})

API

Data options

  • --date=YYYY-MM-DD [today] The date to start getting geohashes. Defaults to todays's date.

  • --days [4] How many does to get in the future. Defaults to 4 or up to the most current date that has available data.

  • --location=lat,lon [current location] Your location. By default it will try and use `whereami` to find your current location.

  • --key The Google maps static maps API key to use for your maps. This only needs to be used if you'll be visiting for than 1000 map links in a 24 hour period. See the Google docs for more info.

  • --cache [$HOME/.config/djia/djia_cache.json] The file or directory where you want to cache Dow Jones data. See the djia module documentation for more info.

Output options

  • -j, --json [false] Output the full JSON information.

  • -p, --pretty [false] Make the json output prettier.

  • -t, --table [false] Output tables of all the distances for each day.

  • -o, --open [false] Open all maps in your default browser.

  • -h, --help [false] Output the help information and exit.

  • --version [false] Output the version and exit.

Other Modules

This is built from other modules that were created to be smaller parts of this one:

Contributing

This is written in ES6 and compiled to ES5 using babel. The code you require will come from the lib/ directory which gets compiled from src/ before each npm publish.

License

MIT