Giter VIP home page Giter VIP logo

jjsgeonamesbundle's Introduction

Geonames Bundle

Introduction

Provides access to the data exported by geonames.org into [symfony 2][sf2] applications.

What is geonames.org

From the geonames.org website:

The GeoNames geographical database covers all countries and contains over eight million placenames that are available for download free of charge.

When to use this bundle

Most useful application for this bundle is to normalize the geograhical information stored in your database such as Countries, States and Cities. Thanks to the extensive geonames.org data almost all cities, towns and suburbs are covered worldwide.

Features

  • Imports the following geonames.org data:

    • Countries
    • Timezones
    • States & Provences
    • Cities, Towns, Suburbs, Villages etc.
  • Provides the following data store implementations:

    • Doctrine ORM

Installation

  1. Install the bundle using composer:

    composer require jjs/geonames-bundle:*

    Or add it to your composer.json file directly

    {
        require: {
            "jjs/geonames-bundle": "*"
        }
    }
  2. Add the bundle to your AppKernel.php

    // AppKernel::registerBundles()
    $bundles = array(
        // ...
        new JJs\Bundle\GeonamesBundle\JJsGeonamesBundle(),
        // ...
    );

Install or update database schema

The database schema for he bundle is defined using doctrine migrations. Migration versioning is designed so they can be merged into your application migrations or migrate the schema manually.

Independant versioning

Execute the migrations using the supplied migration configuration

# Run in your project root directory
app/console doctrine:migrations:migrate --configuration=vendor/jjs/geonames-bundle/JJs/GeonamesBundle/migrations.xml

Application versioning

This schema management stragegy involves more configuration and management, but comes with the benefit of greater control. It is possible due to mapping between incremental database version and semantic bundle version. It involves 'folding' the geonames schema versioning into your own migrations and managing the migration of your database as a whole.

As yet this versioning strategy is undocumented, please contact me if you're interested in using it and I will write the documentation.

Import the data

Note that importing the data from the remote geonames.org repository involves downloading almost 250 MB data from geonames.org.

The following commands can be used in sequence to load all supported data from the geonames.org export (http://download.geonames.org/export/dump)

Import countries

Loads a list of all countries which are refenced by the other imported data such as timezones and localities.

app/console geonames:load:countries

Import timezones

Loads a list of timezones mapped to countries

app/console geonames:load:timezones

Import localities

There are two options for importing the localities - either the whole world at once or batched by countries. Internally the same import mechanism is used and the import process will download a data file for each country and then process the country files individually.

Note the full load process may take several hours to complete and requires a large amount of memory.

# All countries
app/console geonames:load:localities

# Subset of countries (list the desired contries as arguments)
app/console geonames:load:localities US CA

jjsgeonamesbundle's People

Contributors

josiah avatar bluestart83 avatar

Watchers

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.