GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
country = 'UK' not returning anything.  XML
Forum Index -> General
Author Message
xpro



Joined: 29/09/2015 10:34:46
Messages: 2
Offline

I have loaded geonames into my own Postgres database but the following query returns no results

select * from geoname where country = 'UK' order by random() LIMIT 1

However the query works when I use 'US' or 'CA' as the country parameter. Why is 'UK' not returning anything?
barryhunter


[Avatar]

Joined: 13/09/2006 21:25:40
Messages: 27
Offline

The 'country code' for the UK, is actually GB

select * from geoname where country = 'GB' order by random() LIMIT 1


Possibly confusion when the standard was devised, GB is short for Great Britain which is often confused with United Kingdom. When defining country top level domains, undid this mistake and switched to the more understandable .uk (.gb domains are not used)

--
- www.nearby.org.uk - www.geograph.org.uk -
[WWW]
rg_it



Joined: 19/10/2015 13:34:37
Messages: 2
Offline

Did you try GB?

allCountries data uses ISO 2 lett country codes (I'm guessing that's what you import into your PostgreSQL)

From countryInfo:
Code:
 #ISO	ISO3	ISO-Numeric	fips	Country	Capital	Area(in sq km)	Population	Continent	tld	CurrencyCode	CurrencyName	Phone	Postal Code Format	Postal Code Regex	Languages	geonameid	neighbours	EquivalentFipsCode
 GB	GBR	826	UK	United Kingdom	London	244820	62348447	EU	.uk	GBP	Pound	44	@# #@@|@## #@@|@@# #@@|@@## #@@|@#@ #@@|@@#@ #@@|GIR0AA	^(([A-Z]\d{2}[A-Z]{2})|([A-Z]\d{3}[A-Z]{2})|([A-Z]{2}\d{2}[A-Z]{2})|([A-Z]{2}\d{3}[A-Z]{2})|([A-Z]\d[A-Z]\d[A-Z]{2})|([A-Z]{2}\d[A-Z]\d[A-Z]{2})|(GIR0AA))$	en-GB,cy-GB,gd	2635167	IE	
 
gadacz


[Avatar]

Joined: 10/04/2008 07:56:38
Messages: 8
Location: Fichtenwalde/DE
Offline

rg_it wrote:
allCountries data uses ISO 2 lett country codes (I'm guessing that's what you import into your PostgreSQL)

From countryInfo:
Code:
 #ISO  ISO3	ISO-Numeric	fips	Country	Capital	.....
 GB	GBR	826	UK	United Kingdom	London ....
 

I found 'UK' in column `fips` not in `country`.

I also don't find 'UK' in 'alternateNames'.

Maybe you'll better search un Ukraine?

today is the first day of the rest of my life
[WWW] [ICQ]
patrickswez



Joined: 03/11/2015 17:22:03
Messages: 2
Location: South Pasadena
Offline

Exactly try GB not Uk.
[WWW]
danielhp


[Avatar]

Joined: 11/11/2015 08:46:52
Messages: 2
Location: China
Offline

Wow, I did not know that "GB" is "UK" before, maybe other place mistake is because of the same reason for me. thanks

http://www.yixinframe.com/Moulding-33-1.html
[WWW]
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team