world.db.codes - 245 Country Codes (Alpha2, Alpha3, TLDs, etc.) - Sinatra Sample Web App

41 views
Skip to first unread message

Gerald Bauer

unread,
Nov 11, 2014, 6:39:19 PM11/11/14
to open...@googlegroups.com
Hello,

I've put together a small Sinatra sample web app that shows all the
world's country codes (so far alpha 2, alpha 3, internet top level
domains and motor vehicle license plates codes included.) All code
and datasets public domain. See a live country code page [1] on Heroku
or check the world.db.codes source on GitHub [2].

Cheers.

[1] countrycodes.herokuapp.com
[2] github.com/worlddb/world.db.codes

PS: The sample also shows how to (auto-)download the world.db datasets
as a zip archive (~150k) and load the datasets into an SQL database
(without unzipping). See the Rakefile (Ruby make build script).
Example:

ZIP_PATH = "./tmp"
WORLD_NAME = 'world.db'
WORLD_URL = "https://github.com/openmundi/#{WORLD_NAME}/archive/master.zip"
WORLD_ZIP = "#{ZIP_PATH}/#{WORLD_NAME}.zip"

## download world.db dataset
task :dl_world do
dowload_archive( WORLD_URL, WORLD_ZIP )
end

## import world.db dataset
task :load_world do
# NOTE: assume env (database connection) is setup
WorldDb.read_setup_from_zip( WORLD_NAME, 'setups/sport.db.admin',
ZIP_PATH, { skip_tags: true } )
end
Reply all
Reply to author
Forward
0 new messages