@hebcal/geo-sqlite
TypeScript icon, indicating that this package has built-in type declarations

5.0.6 • Public • Published

hebcal-geo-sqlite

Hebcal ES6 interface to GeoNames and USA ZIP code SQLite databases

This package is designed for the hebcal.com and may not be generally reusable. It requires two separate databases, one made from GeoNames.org data (available via a Creative Commons license) and a USA ZIP code database (commercial license).

Installation

$ npm install @hebcal/geo-sqlite
$ ./node_modules/.bin/download-and-make-dbs

Synopsis

import {Location} from '@hebcal/core';
import {GeoDb} from '@hebcal/geo-sqlite';
import pino from 'pino';
const logger = pino();

const db = new GeoDb(logger, 'zips.sqlite3', 'geonames.sqlite3');
const loc1 = db.lookupZip('90210'); // Beverly Hills, California
const loc2 = db.lookupGeoname(293397); // Tel Aviv
const loc3 = db.lookupLegacyCity('IL-Netanya');
db.close();

Classes

GeoDb

Wrapper around sqlite databases

GeoDb

Wrapper around sqlite databases

Kind: global class

new GeoDb(logger, zipsFilename, geonamesFilename)

Param Type
logger any
zipsFilename string
geonamesFilename string

geoDb.close()

Closes database handles

Kind: instance method of GeoDb

geoDb.lookupZip(zip) ⇒ Location

Kind: instance method of GeoDb

Param Type
zip string

geoDb.lookupGeoname(geonameid) ⇒ Location

Kind: instance method of GeoDb

Param Type
geonameid number

geoDb.lookupLegacyCity(cityName) ⇒ Location

Kind: instance method of GeoDb

Param Type
cityName string

Readme

Keywords

Package Sidebar

Install

npm i @hebcal/geo-sqlite

Weekly Downloads

45

Version

5.0.6

License

BSD-2-Clause

Unpacked Size

669 kB

Total Files

10

Last publish

Collaborators

  • mjradwin