2017 © Pedro Peláez
 

package geonames-importer

CSV data importer from geonames.org

image

kalyabin/geonames-importer

CSV data importer from geonames.org

  • Thursday, June 16, 2016
  • by mkalyabin
  • Repository
  • 2 Watchers
  • 6 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 20 % Grown

The README.md

Geonames.org importer API

CSV data importer from geonames.org, (*1)

Use open CSV base from geonames: - cities bases (cities5000.zip, cities15000.zip, RU.zip, US.zip, etc.) - countries base - states base (admin1code.csv), (*2)

Installation

Run in your console, (*3)

php composer.phar require "kalyabin/geonames-importer" "dev-master"

Import all countries

$importer = new \kalyabin\geonames\importer\Country('/tmp/', function($country) {
    print 'Consume country: ' . "\n";
    print_r($country);
    print "\n";
    // do something else
});
$importer->process();

Import cities

$importer = new \kalyabin\geonames\importer\City('/tmp/', 'cities5000.zip', function($city) {
    print 'Consume city: ' . "\n";
    print_r($city);
    print "\n";
    // do something else
});
$importer->process();

You may type second param like RU.zip, US.zip, cities15000.zip, etc., (*4)

Import states

$importer = new \kalyabin\geonames\importer\Admin1CodeASCII('/tmp/', function($region) {
    fwrite(STDOUT, "Consume region: ");
    print_r($region);
    fwrite(STDOUT, "\n");
});
$importer->process();

More about geonames open base read at http://download.geonames.org/export/dump/readme.txt, (*5)

The Versions

16/06 2016

dev-master

9999999-dev

CSV data importer from geonames.org

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-zip *

 

geonames kalyabin cities database countries database