Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukekarrys/geo-graticule
Helper for turning a geocode into information about its graticule.
https://github.com/lukekarrys/geo-graticule
Last synced: 16 days ago
JSON representation
Helper for turning a geocode into information about its graticule.
- Host: GitHub
- URL: https://github.com/lukekarrys/geo-graticule
- Owner: lukekarrys
- License: mit
- Created: 2015-05-02T18:30:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-07T03:43:42.000Z (almost 7 years ago)
- Last Synced: 2024-10-20T14:33:18.469Z (17 days ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
geo-graticule
===================Helper for turning a geocode into information about its graticule.
I use this for [xkcd Geohashing](https://xkcd.com/426/).
[![NPM](https://nodei.co/npm/geo-graticule.png)](https://nodei.co/npm/geo-graticule/)
[![Build Status](https://travis-ci.org/lukekarrys/geo-graticule.png?branch=master)](https://travis-ci.org/lukekarrys/geo-graticule)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
[![Greenkeeper badge](https://badges.greenkeeper.io/lukekarrys/geo-graticule.svg)](https://greenkeeper.io/)## Install
`npm install geo-graticule`
## Usage
```js
import Geo from 'geo-graticule'const geo = new Geo(34.189, -110.8567)
geo.toString() // '34.189,-110.8567'
get.toArray() // [ 34.189, -110.8567 ]
get.toJSON() // { latitude: 34.189, longitude: -110.8567 }geo.quadrant() // 'NW'
geo.graticule() // [ 34, -110 ]
geo.graticuleCenter() // [ 34.5, -110.5 ]
geo.graticuleBox() // [ [ 34, -110 ], [ 34, -111 ], [ 35, -111 ], [ 35, -110 ] ]geo.pointWithinGraticule(0.456, 0.2345) // [ 34.456, -110.2345 ]
```## API
#### `new Geo(latitude, longitude)`
The constructor accepts numbers or strings for any of the values. It will also accept an object with keys `latitude|lat` and `longitude|long|lon` or an array of `[latitude, longitude]`.
#### Return values
All values returned (whether inside objects or arrays) from methods will be a `Number` (except for `toString`).
## Contributing
This is written in ES6 and compiled to ES5 using [`babel`](https://babeljs.io/). The code you require will come from the `lib/` directory which gets compiled from `src/` before each `npm publish`.
## Tests
`npm test`
## License
MIT