<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "getting continent code with java webservice"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "getting continent code with java webservice"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>getting continent code with java webservice</title>
				<description><![CDATA[ hello,

let me quickly explain what I want to do: 

I have a java project that uses the twitter4j library to get all the twitter followers of a specific twitter account. I now want to count, how many followers of that account com from each continent. To do tha, I want to find out, from which continent the twitter user come from. with the help of the twitter4j library I can get the information the user added in his twitter profile, which is often very sketchy and not complete or even the same for different users that come from the same country. so for example one writes briatin and the next writes UK or just london. to get the continet I hope that the GeoNames webservice for java can help. so far I used this example with mixed results: 
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
WebService.setUserName&#40;"demo"&#41;; // add your username here
		 
		  ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria&#40;&#41;;
		  searchCriteria.setQ&#40;"zurich"&#41;;
		  
		  ToponymSearchResult searchResult = WebService.search&#40;searchCriteria&#41;;
		  for &#40;Toponym toponym : searchResult.getToponyms&#40;&#41;&#41; {
		     System.out.println&#40;"Country: " + toponym.getCountryCode&#40;&#41; + " Continent: " + toponym.getContinentCode&#40;&#41; &#41;;
		  }
</pre>
		</div>

I do get the results but the continet is null. I´m also wondering why there are so many resutls for one query. Even if I search for britain or germany I get a lot of different results and the continent is always null. Can somebody help?

thanks:)

k.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/3851.page#11469</guid>
				<link>http://forum.geonames.org/gforum/posts/list/3851.page#11469</link>
				<pubDate><![CDATA[Mon, 7 May 2012 07:52:57]]> GMT</pubDate>
				<author><![CDATA[ kris]]></author>
			</item>
			<item>
				<title>Re:getting continent code with java webservice</title>
				<description><![CDATA[ Hi Kris

The continentCode is not included in the default xml result. You have to set the style to FULL to retrieve the attribute. 
It is a bug in the client code to not throw an exception when the continent code is retrieved without setting the proper style.

Best Regards

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/3851.page#11470</guid>
				<link>http://forum.geonames.org/gforum/posts/list/3851.page#11470</link>
				<pubDate><![CDATA[Mon, 7 May 2012 08:05:12]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
	</channel>
</rss>