node package manager

pelias-geonames

This repository is part of the Pelias project. Pelias is an open-source, open-data geocoder built by Mapzen that also powers Mapzen Search. Our official user documentation is here.

Pelias Geonames importer

Gitter Build Status

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

Requirements

  • Node.js '4.0' or greater

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",
            "adminLookup": false,
            "countryCode": "MX"
        }
    }
}

The following are all optional:

  • datapath: the path to geonames data. Defaults to a directory inside the importer.
  • adminLookup - set this to true to fill in the administrative hierarchy (country, state, county, etc. names), at the cost of higher memory requirements and slower import times. See the pelias/wof-admin-lookup readme for more information on how this works and setup documentation (note: this will require downloading the full Who's on First dataset).
  • 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.

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

npm run download

Import the downloaded data

npm start

Updating Metadata

The metadata shipped with the repo can get out-of-date, to pull the latest metadata run

npm run download_metadata