'encode' also accepts string.

This commit is contained in:
Yusuke Wada
2018-11-22 10:57:17 +09:00
parent c8b8c10fce
commit 4804c30a55
2 changed files with 2 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ declare namespace ngeohash {
type GeographicBoundingBox = [number, number, number, number];
type NSEW = [number, number];
function encode(latitude: number, longitude: number, precision?: number): string;
function encode(latitude: number|string, longitude: number|string, precision?: number): string;
function decode(hashstring: string): GeographicPoint;
function decode_bbox(hashstring: string): GeographicBoundingBox;
function bboxes(minlat: number, minlon: number, maxlat: number, maxlon: number, precision?: number): Array<string>;

View File

@@ -1,6 +1,7 @@
import geohash = require('ngeohash');
console.log(geohash.encode(37.8324, 112.5584));
console.log(geohash.encode('37.8324', '112.5584'));
// prints ww8p1r4t8
var latlon = geohash.decode('ww8p1r4t8');