Merge lp:~hloeung/ubuntu-geonames/add-country-continent into lp:ubuntu-geonames

Proposed by Haw Loeung
Status: Merged
Merged at revision: 33
Proposed branch: lp:~hloeung/ubuntu-geonames/add-country-continent
Merge into: lp:ubuntu-geonames
Diff against target: 50 lines (+5/-3)
2 files modified
geoname-modpython.py (+3/-1)
geoname.py (+2/-2)
To merge this branch: bzr merge lp:~hloeung/ubuntu-geonames/add-country-continent
Reviewer Review Type Date Requested Status
Paul Collins lgtm Approve
Ubuntu Geonames Hackers Pending
Review via email: mp+432157@code.launchpad.net

Description of the change

We're already importing continent from countryInfo.txt. Let's serve that up.

Per http://download.geonames.org/export/dump/readme.txt

Continent codes :
AF : Africa geonameId=6255146
AS : Asia geonameId=6255147
EU : Europe geonameId=6255148
NA : North America geonameId=6255149
OC : Oceania geonameId=6255151
SA : South America geonameId=6255150
AN : Antarctica geonameId=6255152

To post a comment you must log in.
Revision history for this message
Paul Collins (pjdc) :
review: Approve (lgtm)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'geoname-modpython.py'
--- geoname-modpython.py 2015-12-16 22:26:11 +0000
+++ geoname-modpython.py 2022-10-26 02:11:08 +0000
@@ -13,6 +13,7 @@
13admin1codes.name,13admin1codes.name,
14admin2codes.name,14admin2codes.name,
15countryInfo.name,15countryInfo.name,
16countryInfo.continent,
16geoname.longitude,17geoname.longitude,
17geoname.latitude,18geoname.latitude,
18geoname.timezone,19geoname.timezone,
@@ -28,6 +29,7 @@
28admin1codes.name,29admin1codes.name,
29admin2codes.name,30admin2codes.name,
30countryInfo.name,31countryInfo.name,
32countryInfo.continent,
31geoname.longitude,33geoname.longitude,
32geoname.latitude,34geoname.latitude,
33geoname.timezone,35geoname.timezone,
@@ -43,7 +45,7 @@
43"""45"""
44jsonheader = '['46jsonheader = '['
45jsonfooter = ']'47jsonfooter = ']'
46jsonentry = '{"name" : "%s", "admin1" : "%s", "admin2" : "%s", "country" : "%s", ' \48jsonentry = '{"name" : "%s", "admin1" : "%s", "admin2" : "%s", "country" : "%s", "continent" : "%s", ' \
47 '"longitude" : "%F", "latitude" : "%F" , "timezone" : "%s" }'49 '"longitude" : "%F", "latitude" : "%F" , "timezone" : "%s" }'
4850
49def handler(req):51def handler(req):
5052
=== modified file 'geoname.py'
--- geoname.py 2011-04-05 19:00:42 +0000
+++ geoname.py 2022-10-26 02:11:08 +0000
@@ -1,7 +1,7 @@
1import sphinxapi1import sphinxapi
2import cherrypy2import cherrypy
3import psycopg23import psycopg2
4statement = "SELECT geoname.name, admin1codes.name, countryInfo.name, \4statement = "SELECT geoname.name, admin1codes.name, countryInfo.name, countryInfo.continent, \
5geoname.longitude, geoname.latitude FROM admin1codes, geoname, countryInfo \5geoname.longitude, geoname.latitude FROM admin1codes, geoname, countryInfo \
6WHERE code = geoname.country||'.'||geoname.admin1 AND \6WHERE code = geoname.country||'.'||geoname.admin1 AND \
7countryInfo.iso_alpha2=geoname.country AND geoname.geonameid=%s;"7countryInfo.iso_alpha2=geoname.country AND geoname.geonameid=%s;"
@@ -14,7 +14,7 @@
14testentry = '%s (%s, %s) <font size="-2">[%F, %F]</font><br />'14testentry = '%s (%s, %s) <font size="-2">[%F, %F]</font><br />'
15jsonheader = '['15jsonheader = '['
16jsonfooter = ']'16jsonfooter = ']'
17jsonentry = '{"name" : "%s", "admin1" : "%s", "country" : "%s", "longitude" : "%F", "latitude" : "%F" }'17jsonentry = '{"name" : "%s", "admin1" : "%s", "country" : "%s", "continent" : "%s", "longitude" : "%F", "latitude" : "%F" }'
1818
19class Geoname:19class Geoname:
20 def index(self, query=""):20 def index(self, query=""):

Subscribers

People subscribed via source and target branches

to all changes: