<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "InsufficientStyleException on getPopulation() in Java"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "InsufficientStyleException on getPopulation() in Java"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>InsufficientStyleException on getPopulation() in Java</title>
				<description><![CDATA[ I'm getting an error when trying to check the population using the Java API. I did find <a href="http://dev.geonames.org/source-code/javadoc/index.html?org/geonames/Toponym.html" target="_new" rel="nofollow">the documentation for this error</a> but it's not detailed enough for me to understand how to fix it. 

I search for a place by name:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria&#40;&#41;;
searchCriteria.setName&#40;candidatePlace&#41;;
List&lt;Toponym&gt; hits = check.getToponyms&#40;&#41;;</pre>
		</div>

Then I loop through the hits list, checking whether each one is an exact name match...
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>if &#40;testing.getName&#40;&#41;.equals&#40;candidatePlace&#41;&#41; {...</pre>
		</div>

And whether it's in a hashset of acceptable feature codes that I created...
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>if &#40;acceptableClasses.contains&#40;testing.getFeatureCode&#40;&#41;&#41;&#41; {...</pre>
		</div>

And that all works fine. But when I want to check whether the population is big enough, seemingly in a very similar way, it doesn't work.
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>if &#40;testing.getPopulation&#40;&#41; &gt; 10000&#41; {...</pre>
		</div>

This throws
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>org.geonames.InsufficientStyleException: population not supported by style MEDIUM</pre>
		</div>

What is "style MEDIUM" in this context? Is there something wrong with the way I've retrieved the list of candidate Toponyms?]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/3149.page#10579</guid>
				<link>http://forum.geonames.org/gforum/posts/list/3149.page#10579</link>
				<pubDate><![CDATA[Sat, 5 Nov 2011 15:02:21]]> GMT</pubDate>
				<author><![CDATA[ bradamant]]></author>
			</item>
			<item>
				<title>Re:InsufficientStyleException on getPopulation() in Java</title>
				<description><![CDATA[ The api is using the xml webservice:  
http://www.geonames.org/export/geonames-search.html

The xml response only includes population data for style 'FULL' or 'LONG'. You therefore have to set the style to be able to retrieve the population for the search.

Best Regards

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/3149.page#10583</guid>
				<link>http://forum.geonames.org/gforum/posts/list/3149.page#10583</link>
				<pubDate><![CDATA[Sun, 6 Nov 2011 21:55:37]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
	</channel>
</rss>