worlddb gem v2.0 - Free Open World Data, Schema n Models (Places/Countries/Regions/Cities)

47 views
Skip to first unread message

Gerald Bauer

unread,
Mar 24, 2014, 3:20:51 AM3/24/14
to open...@googlegroups.com
Hello,

I've updated the worlddb gem [1] that includes models for places,
continent, countries, regions, cities and more. What's new in v2.0?

The worlddb gem now includes new places and names tables, that is,
every continent, country, region, city is also a place w/ longitude
and latitude.

The project also includes free open public domain plain text
fixtures [2] for all countries and territories in the world plus some
regions/state/provinces and some cities/towns/hamlets/etc.

Use it like:

at = Country.find_by! key: 'at'
at.name
# => 'Austria'
at.pop
# => 8_414_638
at.area
# => 83_871

at.regions.count
# => 9
at.regions
# => [ 'Wien', 'Niederösterreich', 'Oberösterreich', ... ]

at.cities.by_pop
# => [ 'Wien', 'Graz', 'Linz', 'Salzburg', ... ]

Note, the worlddb also supports tags and taggings:

euro = Tag.find_by! key: 'euro'
euro.countries.count
# => 17
euro.countries
# => ['Austria, 'Belgium', 'Cyprus', ... ]

flanders = Tag.find_by! key: 'flanders'
flanders.regions.count
# => 5
flanders.regions
# => ['Antwerpen', 'Brabant Wallon', 'Limburg', 'Oost-Vlaanderen', ... ]
flanders.regions.first.country.name
# => 'Belgium'

Cheers.

[1] github.com/geraldb/world.db.ruby
[2] github.com/openmundi
Reply all
Reply to author
Forward
0 new messages