@types/latlon-geohash
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,7 +0,1 @@ | ||
// Type definitions for latlon-geohash 2.0 | ||
// Project: https://github.com/chrisveness/latlon-geohash, http://www.movable-type.co.uk/scripts/geohash.html | ||
// Definitions by: Robert Imig <https://github.com/rimig> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.4 | ||
declare namespace Geohash { | ||
@@ -8,0 +2,0 @@ enum Direction { |
{ | ||
"name": "@types/latlon-geohash", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "TypeScript definitions for latlon-geohash", | ||
@@ -10,4 +10,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/latlon-geohash", | ||
"name": "Robert Imig", | ||
"url": "https://github.com/rimig", | ||
"githubUsername": "rimig" | ||
"githubUsername": "rimig", | ||
"url": "https://github.com/rimig" | ||
} | ||
@@ -24,4 +24,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "f7b34370df86132f6536b4d5c5ee2fa47cc8df0ebdcb54fae8ff5de9a622261d", | ||
"typeScriptVersion": "4.3" | ||
"typesPublisherContentHash": "1975b7a53d11b9418f4b3f2c9547e038de27daa1110e56994e70fcaab1050176", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -9,9 +9,103 @@ # Installation | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/latlon-geohash. | ||
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/latlon-geohash/index.d.ts) | ||
````ts | ||
declare namespace Geohash { | ||
enum Direction { | ||
North = "N", | ||
South = "S", | ||
East = "E", | ||
West = "W", | ||
} | ||
interface Neighbours { | ||
n: string; | ||
ne: string; | ||
e: string; | ||
se: string; | ||
s: string; | ||
sw: string; | ||
w: string; | ||
nw: string; | ||
} | ||
interface Bounds { | ||
sw: Point; | ||
ne: Point; | ||
} | ||
interface Point { | ||
lat: number; | ||
lon: number; | ||
} | ||
/** | ||
* Encodes latitude/longitude to geohash, either to specified precision or to automatically | ||
* evaluated precision. | ||
* | ||
* @param lat - Latitude in degrees. | ||
* @param lon - Longitude in degrees. | ||
* @param [precision] - Number of characters in resulting geohash. | ||
* @returns Geohash of supplied latitude/longitude. | ||
* @throws Invalid geohash. | ||
* | ||
* @example | ||
* var geohash = Geohash.encode(52.205, 0.119, 7); // geohash: 'u120fxw' | ||
*/ | ||
function encode( | ||
latitude: number, | ||
longitude: number, | ||
precision?: number, | ||
): string; | ||
/** | ||
* Decode geohash to latitude/longitude (location is approximate centre of geohash cell, | ||
* to reasonable precision). | ||
* | ||
* @param geohash - Geohash string to be converted to latitude/longitude. | ||
* @returns (Center of) geohashed location. | ||
* @throws Invalid geohash. | ||
* | ||
* @example | ||
* var latlon = Geohash.decode('u120fxw'); // latlon: { lat: 52.205, lon: 0.1188 } | ||
*/ | ||
function decode(geohash: string): Point; | ||
/** | ||
* Returns SW/NE latitude/longitude bounds of specified geohash. | ||
* | ||
* @param geohash - Cell that bounds are required of. | ||
* @returns The Bounds | ||
* @throws Invalid geohash. | ||
*/ | ||
function bounds(geohash: string): Bounds; | ||
/** | ||
* Determines adjacent cell in given direction. | ||
* | ||
* @param geohash - Cell to which adjacent cell is required. | ||
* @param direction - Direction from geohash (N/S/E/W). | ||
* @returns Geocode of adjacent cell. | ||
* @throws Invalid geohash. | ||
*/ | ||
function adjacent(geohash: string, direction: Direction | string): string; | ||
/** | ||
* Returns all 8 adjacent cells to specified geohash. | ||
* | ||
* @param geohash - Geohash neighbours are required of. | ||
* @returns The neighbours | ||
* @throws Invalid geohash. | ||
*/ | ||
function neighbours(geohash: string): Neighbours; | ||
} | ||
export default Geohash; | ||
```` | ||
### Additional Details | ||
* Last updated: Wed, 30 Aug 2023 19:34:50 GMT | ||
* Last updated: Wed, 18 Oct 2023 05:47:07 GMT | ||
* Dependencies: none | ||
* Global values: none | ||
# Credits | ||
These definitions were written by [Robert Imig](https://github.com/rimig). |
7500
111
82