@hebcal/geo-sqlite 4.4.3 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/geo-sqlite v4.4.3 */
1
+ /*! @hebcal/geo-sqlite v4.5.0 */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -60,11 +60,11 @@ FROM ZIPCodes_Primary
60
60
  WHERE ZipCode LIKE ?
61
61
  ORDER BY Population DESC
62
62
  LIMIT 10`;
63
- const ZIP_FULLTEXT_COMPLETE_SQL = `SELECT ZipCode, rank
63
+ const ZIP_FULLTEXT_COMPLETE_SQL = `SELECT ZipCode
64
64
  FROM ZIPCodes_CityFullText5
65
65
  WHERE ZIPCodes_CityFullText5 MATCH ?
66
66
  LIMIT 20`;
67
- const GEONAME_COMPLETE_SQL = `SELECT geonameid, rank
67
+ const GEONAME_COMPLETE_SQL = `SELECT geonameid
68
68
  FROM geoname_fulltext
69
69
  WHERE geoname_fulltext MATCH ?
70
70
  LIMIT 20`;
@@ -371,7 +371,6 @@ class GeoDb {
371
371
  const loc = this.lookupGeoname(res.geonameid);
372
372
  const country = this.countryNames.get(loc.getCountryCode()) || '';
373
373
  const admin1 = loc.admin1 || '';
374
- const rankPop = Math.sqrt(loc.population) / 40;
375
374
  const obj = {
376
375
  id: res.geonameid,
377
376
  value: loc.name,
@@ -380,8 +379,7 @@ class GeoDb {
380
379
  latitude: loc.latitude,
381
380
  longitude: loc.longitude,
382
381
  timezone: loc.getTzid(),
383
- geo: 'geoname',
384
- rank: rankPop + -30 * res.rank
382
+ geo: 'geoname'
385
383
  };
386
384
 
387
385
  if (loc.population) {
@@ -411,7 +409,6 @@ class GeoDb {
411
409
  const zipMatches = zipRows.map(res => {
412
410
  const zipCode = res.ZipCode;
413
411
  const loc = this.lookupZip(zipCode);
414
- const rankPop = Math.sqrt(loc.population) / 40;
415
412
  const obj = {
416
413
  id: zipCode,
417
414
  value: loc.getName(),
@@ -422,8 +419,7 @@ class GeoDb {
422
419
  longitude: loc.longitude,
423
420
  timezone: loc.getTzid(),
424
421
  population: loc.population,
425
- geo: 'zip',
426
- rank: rankPop + -30 * res.rank
422
+ geo: 'zip'
427
423
  };
428
424
  return obj;
429
425
  });
@@ -444,8 +440,8 @@ class GeoDb {
444
440
  }
445
441
 
446
442
  const values = Array.from(map.values());
447
- values.sort((a, b) => b.rank - a.rank);
448
- const topN = values.slice(0, 10);
443
+ values.sort((a, b) => b.population - a.population);
444
+ const topN = values.slice(0, 15);
449
445
 
450
446
  if (!latlong) {
451
447
  for (const val of topN) {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/geo-sqlite v4.4.3 */
1
+ /*! @hebcal/geo-sqlite v4.5.0 */
2
2
  import Database from 'better-sqlite3';
3
3
  import { Location, Locale } from '@hebcal/core';
4
4
  import '@hebcal/cities';
@@ -48,11 +48,11 @@ FROM ZIPCodes_Primary
48
48
  WHERE ZipCode LIKE ?
49
49
  ORDER BY Population DESC
50
50
  LIMIT 10`;
51
- const ZIP_FULLTEXT_COMPLETE_SQL = `SELECT ZipCode, rank
51
+ const ZIP_FULLTEXT_COMPLETE_SQL = `SELECT ZipCode
52
52
  FROM ZIPCodes_CityFullText5
53
53
  WHERE ZIPCodes_CityFullText5 MATCH ?
54
54
  LIMIT 20`;
55
- const GEONAME_COMPLETE_SQL = `SELECT geonameid, rank
55
+ const GEONAME_COMPLETE_SQL = `SELECT geonameid
56
56
  FROM geoname_fulltext
57
57
  WHERE geoname_fulltext MATCH ?
58
58
  LIMIT 20`;
@@ -359,7 +359,6 @@ class GeoDb {
359
359
  const loc = this.lookupGeoname(res.geonameid);
360
360
  const country = this.countryNames.get(loc.getCountryCode()) || '';
361
361
  const admin1 = loc.admin1 || '';
362
- const rankPop = Math.sqrt(loc.population) / 40;
363
362
  const obj = {
364
363
  id: res.geonameid,
365
364
  value: loc.name,
@@ -368,8 +367,7 @@ class GeoDb {
368
367
  latitude: loc.latitude,
369
368
  longitude: loc.longitude,
370
369
  timezone: loc.getTzid(),
371
- geo: 'geoname',
372
- rank: rankPop + -30 * res.rank
370
+ geo: 'geoname'
373
371
  };
374
372
 
375
373
  if (loc.population) {
@@ -399,7 +397,6 @@ class GeoDb {
399
397
  const zipMatches = zipRows.map(res => {
400
398
  const zipCode = res.ZipCode;
401
399
  const loc = this.lookupZip(zipCode);
402
- const rankPop = Math.sqrt(loc.population) / 40;
403
400
  const obj = {
404
401
  id: zipCode,
405
402
  value: loc.getName(),
@@ -410,8 +407,7 @@ class GeoDb {
410
407
  longitude: loc.longitude,
411
408
  timezone: loc.getTzid(),
412
409
  population: loc.population,
413
- geo: 'zip',
414
- rank: rankPop + -30 * res.rank
410
+ geo: 'zip'
415
411
  };
416
412
  return obj;
417
413
  });
@@ -432,8 +428,8 @@ class GeoDb {
432
428
  }
433
429
 
434
430
  const values = Array.from(map.values());
435
- values.sort((a, b) => b.rank - a.rank);
436
- const topN = values.slice(0, 10);
431
+ values.sort((a, b) => b.population - a.population);
432
+ const topN = values.slice(0, 15);
437
433
 
438
434
  if (!latlong) {
439
435
  for (const val of topN) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/geo-sqlite",
3
- "version": "4.4.3",
3
+ "version": "4.5.0",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "hebcal"