Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,19 @@ | ||
#### 1.0.1 (2020-06-21) | ||
##### Build System / Dependencies | ||
* change firebase hosting project ([ef615a7f](https://github.com/MichaelSolati/geokit/commit/ef615a7f10612dab39cce7e8e8f751dc751f5cc3)) | ||
##### Chores | ||
* update `homepage` in `package.json` ([7a6371c1](https://github.com/MichaelSolati/geokit/commit/7a6371c1d62b65df2a711f7830477c94856345a9)) | ||
##### Documentation Changes | ||
* update docs for functions ([a1a4a243](https://github.com/MichaelSolati/geokit/commit/a1a4a2438a0e7d7a23feb50b9aa66306fb097551)) | ||
##### New Features | ||
* add issue template ([58097c96](https://github.com/MichaelSolati/geokit/commit/58097c96c10f285232d63ed9f8b2d3e9577017bc)) | ||
## 1.0.0 (2020-06-21) | ||
@@ -2,0 +20,0 @@ |
{ | ||
"name": "geokit", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "An assortment of geolocation related tools, all packaged in one easy to use kit.", | ||
@@ -21,3 +21,3 @@ "scripts": { | ||
"author": "Michael Solati <mkslt04@gmail.com>", | ||
"homepage": "https://github.com/MichaelSolati/geokit", | ||
"homepage": "https://geokit.geofirestore.com", | ||
"repository": { | ||
@@ -24,0 +24,0 @@ "type": "git", |
@@ -5,2 +5,4 @@ # geokit | ||
Full documentation is available at [https://geokit.geofirestore.com](https://geokit.geofirestore.com). | ||
An assortment of geolocation related tools, all packaged in one easy to use kit. | ||
@@ -10,45 +12,53 @@ | ||
### `Geokit.distance(start: LatLngLiteral, end: LatLngLiteral, unit?: string): number` | ||
### `distance(start: LatLngLiteral, end: LatLngLiteral, unit?: string): number` | ||
Static method which returns the distance, in kilometers, between `start` and `end`. | ||
Calculates the distance, in kilometers, between two coordinates. | ||
`start` and `end` must be LatLngLiterals `{ lat: 0, lng: 0 }`. | ||
There exists an optional third argument, where if the string `'miles'` is inputted, the result returned will be in miles rather than kilometers. | ||
```TypeScript | ||
import { Geokit, LatLngLiteral } from 'geokit'; | ||
import * as geokit from 'geokit'; | ||
const start: LatLngLiteral = { lat: 40.7128, lng: -74.0060 }; | ||
const end: LatLngLiteral = { lat: 37.7749, lng: -122.4194 }; | ||
const start = {lat: 41.3083, lng: -72.9279}; | ||
const end = {lat: -33.8688, lng: 151.2093}; | ||
const distance: number = Geokit.distance(location1, location2, 'miles'); // distance === 2568.4458439997047 | ||
const distance = geokit.distance(location1, location2); // distance === 16082.811206563834 | ||
``` | ||
### `Geokit.hash(coordinates: LatLngLiteral, precision?: number): string` | ||
### `hash(coordinates: LatLngLiteral, precision?: number): string` | ||
Static method which generates the geohash of a point. | ||
Generates Geohash of coordinates. | ||
`coordinates` must be LatLngLiterals `{ lat: 0, lng: 0 }`. | ||
There exists an optional second argument of precision, where the hash produced will be as many characters as the number inputted. It defaults to 10. | ||
```TypeScript | ||
import * as geokit from 'geokit'; | ||
const coordinates = {lat: 41.3083, lng: -72.9279}; | ||
const hash = geokit.hash(coordinates); // hash === 'drk4urzw2c' | ||
``` | ||
### `decodeHash(hash: string): LatLngLiteral` | ||
Decodes a Geohash into its Latitude and Longitude as a LatLngLiteral. | ||
```TypeScript | ||
import { Geokit, LatLngLiteral } from 'geokit'; | ||
import * as geokit from 'geokit'; | ||
const coordinates: LatLngLiteral = { lat: 41.3083, lng: -72.9279 }; | ||
const hash = 'r3gx2f77b'; | ||
const hash: string = Geokit.hash(coordinates); // hash === 'drk4urzw2c' | ||
const coordinates = geokit.decodeHash(hash); // coordinates === {lat: -33.86881113052368, lng: 151.2093186378479} | ||
``` | ||
### `Geokit.decodeHash(hash: string): LatLngLiteral` | ||
### `validateHash(hash: string): LatLngLiteral` | ||
Static method which decodes geohash into its Latitude and Longitude as a LatLngLiteral. | ||
Validates a Geohash and returns a boolean if valid, or throws an error if invalid. | ||
```TypeScript | ||
import { Geokit, LatLngLiteral } from 'geokit'; | ||
import * as geokit from 'geokit'; | ||
const hash: string = 'r3gx2f77b'; | ||
const hash = 'r3gx2f77b'; | ||
const coordinates: LatLngLiteral = Geokit.decodeHash(hash); // coordinates === { lat: -33.86881113052368, lng: 151.2093186378479 } | ||
const isValid = geokit.validateHash(hash); // true | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24689
63