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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pelias-geonames

v4.0.0

Published

Import pipleine to bring Geonames data into the Pelias Geocoder

Downloads

166

Readme

Pelias Geonames importer

Gitter Greenkeeper badge

This Node.js package imports data from Geonames into Pelias. It includes utilities for downloading and cleaning up the data before import.

Requirements

Installation

git clone https://github.com/pelias/geonames
cd geonames
npm install

Configuration

The importer can be configured from your local pelias-config (defaults to ~/pelias.json) in the imports.geonames object:

{
	"imports": {
		"geonames": {
			"datapath": "/path/to/geonames/data",
			"countryCode": "MX",
			"sourceURL": "http://example.com/geonames/"
		}
	}
}

The following are all optional:

  • datapath: the path to geonames data. Defaults to a directory inside the importer.
  • countryCode: the two digit (ISO 3166-1 alpha-2) country code for the country for which data will be downloaded and imported. Use ALL for all countries.
  • sourceURL: allows for specification of an alternate url prefix for downloads. Will be appended with your specified countryCode and .zip. If the field is undefined or an empty string then the code defaults to the official Geonames dumps.

Admin Lookup

Pelias has the ability to compute the admin hierarchy (county, region, country, etc) from Who's on First data. For more info on how admin lookup works, see the documentation for pelias/wof-admin-lookup. By default, adminLookup is enabled. To disable, set imports.adminLookup.enabled to false in Pelias config.

Note: Admin lookup requires loading around 5GB of data into memory.

Usage

A list of supported countries and their codes can be viewed with npm run countryCodes

$> npm run countryCodes
┌─────┬──────────────────────────────────────────────┬──────────────────────┬───────────┬───────────┐
│ ISO │ Country                                      │ Capital              │ Continent │ geonameid │
│ AD  │ Andorra                                      │ Andorra la Vella     │ EU        │           │
│ AE  │ United Arab Emirates                         │ Abu Dhabi            │ AS        │ 290557    │
│ AF  │ Afghanistan                                  │ Kabul                │ AS        │ 1149361   │
│ AG  │ Antigua and Barbuda                          │ St. John's           │ NA        │ 3576396   │

Download the data

The data corresponding to the countryCode in the pelias config file will be downloaded. npm run download

Import the downloaded data

npm start

Updating Metadata

The metadata is not shipped with the repo, however, during normal usage running npm install will also trigger a script that updates the metadata.

However this hook will not trigger in non-interactive sessions such as many shell scripts. To explicitly download the metadata or refresh it (it changes very infrequently, perhaps every few months), run:

npm run download_metadata

The metadata is packaged in our Docker images, so using an up to date docker image should guarantee recent enough metadata.