Code Monkey home page Code Monkey logo

geonames_local's Introduction

Geonames Local

Downloads and store Geonames.org data locally (MongoDB, Mongoid). Making every Geoname API operation possible on your servers. No hit limit, fast as possible.

  • Download all country data
  • Merges ZIP into cities, so you have masks
  • Updates using geonames IDs, no duplication

Use

Install where you want to populate the DB:

gem install geonames_local

You will also need in your system:

  • unzip
  • curl

Config

Create a config yml file:

geonames init

Will generate a geonames.yml file on your folder. The file is self explanatory.

Geonames splits the nations/countries database from the rest, so: It'll also populate the nations collection automatically: 252 nations.

geonames -c geonames.yml

To run it. Use -v for verbose.

If you are not sure your country/nation code, use:

geonames list <search>

Mongoid

Using http://github.com/fireho/geopolitical models:

City.first.region.nation.abbr => "BR"

Next

  • IP Geonames? http://ipinfodb.com
  • Hoods? ftp://geoftp.ibge.gov.br/malhas_digitais/censo_2010/setores_censitarios/
  • ActiveRecord/PostGIS - someone else

geonames_local's People

Contributors

boxmo avatar nofxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

geonames_local's Issues

Install instructions and dependencies

Hi Marcos, I just discovered this gem and it looked promising!

Then I tried to install it...

First I was told the was no 'geo_ruby' loaded, so I had to add:

gem 'georuby'
gem 'geonames_local' # Downloads and store Geonames.org data locally

Then I bundled again. Now I get.

You've loaded GeoRuby SHP Support.
Please install the gem 'dbf' to use it. gem install dbf

Then I tried

gem 'dbf'
gem 'georuby'
gem 'geonames_local' # Downloads and store Geonames.org data locally

And it seems to work.

Shouldn't these gems be internal dependencies of geonames_local ?

Oh, I see that you recently made a commit "fix dependencies", but it hasn't made it into the release gem yet. Please do!
Thanks!

Command not found after install gem

After install : gem install geonames
I just tip : geonames init
But command this triggers a command not found error.
I try with ruby 2.2 and 1.9 on windows and on linux.
Some help? Thanks!

Data not found for Andorra cities

Hi:
when i select AD as download code (Andorra), appears error:

Traceback (most recent call last):
        5: from ./bin/geonames:10:in `<main>'
        4: from ./geonames_local/lib/geonames_local/cli.rb:160:in `work'
        3: from /usr/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
        2: from ./geonames_local/lib/geonames_local/cli.rb:160:in `block in work'
        1: from ./geonames_local/lib/geonames_local/cli.rb:104:in `work_spots'
./geonames_local/lib/geonames_local/models/mongodb.rb:23:in `batch': undefined method `each' for nil:NilClass (NoMethodError)

rails 4, mongoid 4

I have a problem with use geonames_local.

My Gemfile:
gem 'georuby'
gem 'geonames_local', github: 'nofxx/geonames_local'
gem 'mongoid', github:'mongoid/mongoid'
gem 'mongoid_geospatial', github: 'nofxx/mongoid_geospatial'
gem 'geopolitical'

Commands:

  1. geonames init
  2. bundle exec geonames -c geonames.yml -d -v

I get error with Mongoid::Errors::DocumentNotFound.

Document not found for class Nation with attributes {:abbr=>/BR/i}

Resolution:
Mongoid.raise_not_found_error set to false.

I set this params in config/mongoid.yml

but can't fix...

Validation of City failed

Hi:

I run genoname_local with config:

#
# Geonames Local Config Example
#
:store: mongodb
:level: city
:nations: [es] # [] to populate nations database
:locales: [es, en]
:mapping:
  :name: name
  :geom: true
:db:
  :host: localhost
  :name: geonames_local
  # :user:
  # :password:
  # :purge: false

and find errors like:

message:
  Validation of City failed.
summary:
  The following errors were found: Code is already taken
resolution:
  Try persisting the document with valid data or remove the validations. /var/lib/gems/2.5.0/gems/mongoid-7.0.1/lib/mongoid/persistable.rb:76:in `fail_due_to_validation!'

thanks in advance

Cannot get it up and running (Can't find adapter for mongodb)

Hi Nofxx,

I have some troubles while executing the geonames_local gem:

I did:

gemfile:

gem "mongoid", "~> 3.1.0"
gem 'georuby' # is needed by geonames_local
gem 'geonames_local' #https://github.com/nofxx/geonames_local
> geonames init

geonames.yml

#
# Geonames Local Config Example
#
:store: mongodb
:level: city
:nations: [br, us] # [] to populate nations database
:locales: [pt, en]
:mapping:
  :name: name
  :geom: true
:db:
  :host: localhost
  :name: myappdb_development
  :user:
  :password:
  :purge: false

Now I type:

> geonames -c geoconfig.yml nations
> Closing Geonames...

(shouldn't it be geonames.yml instead of geoconfig.yml?) The file which was created by init was named geonames.yml

I tried:

> geonames -c geonames.yml nations
Loading config file...
Can't find adapter for mongodb
Closing Geonames...
> geonames -c geonames.yml --nations
> Loading config file...
> Can't find adapter for mongodb
> Closing Geonames...
> geonames -c geoconfig.yml --nations
> Loading config file...
> Can't find adapter for mongodb
> Closing Geonames...

What's wrong there? Please help me!

Thank you!

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.