1
0
Fork 0
forked from 0x2620/oxjs

improved geodata and tools

This commit is contained in:
rolux 2011-05-23 21:38:52 +02:00
commit 912f2121a4
47 changed files with 682294 additions and 3535 deletions

19
tools/geo/py/geonames.py Normal file
View file

@ -0,0 +1,19 @@
import ox
from geo import read_json, read_table
geo = {
'keys': read_json('../json/oxjs.org/geonames.keys.json')
#'levels': read_json('../json/oxjs.org/levels.json')
}
def get_countries():
return get_data('country', 'countryInfo', 'ISO')
def get_data(type, file, sort_key):
keys = geo['keys'][type]['geonames.org']
sort = lambda x: x[sort_key]
data = read_table('http://download.geonames.org/export/dump/' + file + '.txt', keys, sort=sort)
return data
def get_languages():
return get_data('language', 'iso-languagecodes', 'ISO_639-3')