npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

geolistic

v0.2.2

Published

Enjoy millions of searchable locations in your app by importing Geoname data into Elastic

Readme

Geolistic

Build Status

Import Geoname data to Elastic and enjoy millions of searchable locations in your app.

Geoname is the most comprehensive open source geo location data source with more than 11 million location points. Each location comes with a wealth of information and can be searched in both English and local languages.

Elastic is the leading open source search engine.

Geolistic connects these powers together and geo-enables your app without api restrictions.

Features

  • Blazing fast buffered import with batch indexing in elastic
  • Filter unwanted data based on their type (city / country etc)
  • Elastic schema included

Install

$ npm install geolistic

Add schema to elastic

$ curl -XPUT http://127.0.0.1:9200/geonames -d @data/schema.json

Usage

Using the command line tool

Use the included command line tool to download all data files

$ node geolistic-cli -downloadall

then add all files to elastic

$ node geolistic-cli -addall

You can also download and add individual countries, e.g. for Austria

$ node geolistic-cli -download AT

and add it

$ node geolistic-cli -add AT

Searching

After adding data, you can try searching:

$ node geolistic-cli -search Wien

Sample query you can use in your own project:

GET /geonames/geoname/_search
{
  "query" : {
      "constant_score" : {
         "filter" : {
            "bool" : {
              "must" : [
                {"query_string": {
                    "query": "Wien",
                    "fields": ["name", "asciiName", "alternateNames"]}
                },
                { "range": { "population": {"gt": 0}}},
                { "term": { "featureClass": "P" }}
              ]
           }
         }
      }
   },
   "sort": [ {"population": {"order": "desc"}}]
}

Using the library

Use as library or command line tool. Init the library like this:

const geolistic = require('geolistic');
geolistic.getGeoNameCountries({allColoumns: true}, function (err, countries) {
   // ...
});

See the api documentation here

Configuration

No configuration is necessary if elastic runs on localhost port 9200 and you're fine with using geonames/geoname as index/type in elastic.

Otherwise you can edit data/cli-config.json or use environment variables:

$ export ELASTIC_URL="localhost:9200"
$ export ELASTIC_PATH="geonames/geoname"
$ export DATAPATH="/tmp/"
$ node geolistic-cli.js -download AT
  • ELASTIC_URL: Address to connect to your elastic instance
  • ELASTIC_PATH: Where to store data in elastic INDEX/TYPE, e.g. geonames/geoname
  • DATAPATH: Path were to download and extract data files, defaults to temp directory

License

The MIT License

Copyright (c) 2017 Gunnar Skeid