Coder Social home page Coder Social logo

geohex-gen's Introduction

geohex-gen

Geohex command line utility

=======

Geohex::Gen

Installation

$ gem install geohex-gen

Usage

This gem installs a command line tool named ghgen that:

  • Given lat, lon return geohex level 10 code.
  • Given a GH (any size), display center lat/lon and show GH4/5/6 that contains this location.
  • Given a GH (any size) and a ring size, display geohex codes that form the ring(s).
$shell> ghgen -h

Usage: ghgen [options]
    -a LAT                           Latitude. If used, must have longitude also
    -o LON                           Longitude. If used, must have latitude also
    -g GH                            Specify center geohex directly
    -r [RING]                        Number of rings around center

Return geohex 4-6 that includes a geohex

$shell> ghgen -g PC22713455

Center GH is PC22713455, located at 32.91066810490208, -117.21383935375704

This location is included in

GH4: PC2271
GH5: PC22713
GH6: PC227134

Note that you can't always truncate a GH string to get to larger size.
Geohexes that are on apex ending with 2 or 6 ends up on parent with different code system. ghgen handles this properly.

$shell> ghgen -g PC2266666

Center GH is PC2266666, located at 32.70505659484853, -115.56470050297207

This location is included in

GH4: PC2500
GH5: PC25000
GH6: PC218888

Get geohex from lat lon

$shell> ghgen -a 32.90475787738992 -o -117.20164609053498

Center GH is PC2271344444, located at 32.90475787738992, -117.20164609053498

This location is included in

GH4: PC2271
GH5: PC22713
GH6: PC227134

Get a list of Geohexes that form one or more ring(s) around the center GH of any size

$shell> ghgen -g PC22751 -r 1

Center GH is PC22751, located at 33.14380613603259, -117.3662551440329

This location is included in

GH4: PC2275
GH5: PC22751
GH6: PC227514

Center PC22751, Ring(s) 1:
PC22727
PC22754
PC22752
PC22726
PC22755
PC22750

You can specify ring size with lat/lon, but the ring is always in GH10.

geohex-gen's People

Contributors

akiatoji avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.