<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "alternative country names"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "alternative country names"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>alternative country names</title>
				<description><![CDATA[ Hi, 
I downloaded the list of all countries - country-info.txt
it would be interesting to have alternative country names. similar to what there is for the cities.

eg:
spain, espana, espagne, etc.

no idea how to build this?
thx 
colin]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/4287.page#12499</guid>
				<link>http://forum.geonames.org/gforum/posts/list/4287.page#12499</link>
				<pubDate><![CDATA[Thu, 13 Jun 2013 07:10:56]]> GMT</pubDate>
				<author><![CDATA[ colinmolter]]></author>
			</item>
			<item>
				<title>Re:alternative country names</title>
				<description><![CDATA[ Hi, I found the solution. I post it hoping it could help someone.
As mentioned by Marc a while ago (sorry I can;t find the link again):
in alternameNames.txt, there is the list of alternate names for everything in all language. 
So, for each country, I get the geonameid, and I grep the associated lines in the alternateNames.txt file. 

I focused on language of the country. so the python code end like this:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
import string, subprocess,pymongo

dbuniverse = pymongo.MongoClient&#40;&#41;&#91;'UNIVERSE'&#93;
colcountry = dbuniverse&#91;'countries'&#93;
altcountryfile = '/Users/colin/Downloads/alternateNames/alternateNames.txt'

cursor = colcountry.find&#40;{'ISO':'BE'}&#41;
for doc in cursor:
	cn=doc&#91;'Country'&#93;
	id=doc&#91;'geonameid'&#93;
	langs=doc&#91;'Languages'&#93;
	print cn,langs
	for l in langs.split&#40;','&#41;:
		ll=l.split&#40;'-'&#41;&#91;0&#93;
		togrep="%s\t%s"%&#40;id,ll&#41;
		p= subprocess.Popen&#40;&#91;'grep',togrep,altcountryfile&#93;, stdout=subprocess.PIPE&#41;
		out =p.stdout.readlines&#40;&#41;
		for r in out:
			data = r.split&#40;'\t'&#41;
			alt_n=data&#91;3&#93;
			print alt_n
			cursor = colcountry.update&#40;{'geonameid':id},{'$addToSet':{'altNames':alt_n}}&#41;
</pre>
		</div>
GeoNames is really great.  8) ]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/4287.page#12504</guid>
				<link>http://forum.geonames.org/gforum/posts/list/4287.page#12504</link>
				<pubDate><![CDATA[Sat, 15 Jun 2013 06:40:19]]> GMT</pubDate>
				<author><![CDATA[ colinmolter]]></author>
			</item>
	</channel>
</rss>