Code Monkey home page Code Monkey logo

geonames's Introduction

pelias-geonames

pelias-geonames comes with a command-line tool to make it easier to download/parse and import country data in to Pelias.

install

npm install

usage

$> ./bin/pelias-geonames

  Usage: pelias-geonames [options]

  Options:

    -h, --help            output usage information
    -V, --version         output the version number
    -c, --countrycodes    list all ISO country datasets available for download
    -i, --import [ISO]    import geoname data for [ISO country code] in to Pelias
    -d, --download [ISO]  locally cache data from geonames.org for [ISO country code]
    -m, --meta            download & update geonames metadata files

importing data

For development it's fastest and easiest to just use the data from your local region.

Eg. To just load data specific to New Zealand you can run:

$> ./bin/pelias-geonames -i nz
streaming datafile from: http://download.geonames.org/export/dump/NZ.zip

You can download and use a cached copy of the geonames data for imports instead:

$> ./bin/pelias-geonames -d nz
downloading datafile from: http://download.geonames.org/export/dump/NZ.zip
 data/NZ.zip           [===================] 100% 0.0s

$> ./bin/pelias-geonames -i nz
reading datafile from disk at: data/NZ.zip

For a production database where you need the entire world, use:

$> ./bin/pelias-geonames -i all
streaming datafile from: http://download.geonames.org/export/dump/allCountries.zip

listing available datasets

To get a list of all available ISO country codes:

$> ./bin/pelias-geonames -c
┌─────┬──────────────────────────────────────────────┬──────────────────────┬───────────┬───────────┐
│ 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   │

updating metadata

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

$> ./bin/pelias-geonames -m
 countryInfo.txt                [===================] 100% 0.0s
 admin1CodesASCII.txt           [===================] 100% 0.0s
 admin2Codes.txt                [===================] 100% 0.0s

pelias-config

The importer can be configured from your local pelias-config in the imports.geonames object:

{
	"imports": {
		"geonames": {
			"datapath": "/path/to/geonames/data",
			"adminLookup": false
		}
	}
}

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 (ie, 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)

geonames's People

Watchers

Adam Stankiewicz avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.