<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://lemuria.org/dragoneye/index.php?action=history&amp;feed=atom&amp;title=Fix_population</id>
	<title>Fix population - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://lemuria.org/dragoneye/index.php?action=history&amp;feed=atom&amp;title=Fix_population"/>
	<link rel="alternate" type="text/html" href="http://lemuria.org/dragoneye/index.php?title=Fix_population&amp;action=history"/>
	<updated>2026-05-03T20:50:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://lemuria.org/dragoneye/index.php?title=Fix_population&amp;diff=1550&amp;oldid=prev</id>
		<title>Tom: Created page with &quot;Save this as fix_population.php and use it as outlined in part 3 of the video tutorial, feeding it the burgs.csv file from Azgaar&#039;s FMG.  &lt;source&gt; &lt;?php  $fp = fopen(&quot;php://st...&quot;</title>
		<link rel="alternate" type="text/html" href="http://lemuria.org/dragoneye/index.php?title=Fix_population&amp;diff=1550&amp;oldid=prev"/>
		<updated>2019-12-09T08:53:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Save this as fix_population.php and use it as outlined in part 3 of the video tutorial, feeding it the burgs.csv file from Azgaar&amp;#039;s FMG.  &amp;lt;source&amp;gt; &amp;lt;?php  $fp = fopen(&amp;quot;php://st...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Save this as fix_population.php and use it as outlined in part 3 of the video tutorial, feeding it the burgs.csv file from Azgaar&amp;#039;s FMG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
$fp = fopen(&amp;quot;php://stdin&amp;quot;, &amp;quot;r&amp;quot;) or die(&amp;quot;cannot open stdin&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
$input_data = file_get_contents(&amp;quot;php://stdin&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
$json = json_decode($input_data);&lt;br /&gt;
&lt;br /&gt;
foreach ($json-&amp;gt;features as &amp;amp;$feature) {&lt;br /&gt;
    preg_match(&amp;#039;/([0-9\.]+K?) \(([0-9\.]+K?) rural, urban ([0-9\.]+K?)\)/&amp;#039;, $feature-&amp;gt;properties-&amp;gt;population, $matches);&lt;br /&gt;
    if ($matches[1] &amp;gt; 0) {&lt;br /&gt;
        $feature-&amp;gt;properties-&amp;gt;population = k_to_number($matches[1]);&lt;br /&gt;
        $feature-&amp;gt;properties-&amp;gt;rural = k_to_number($matches[2]);&lt;br /&gt;
        $feature-&amp;gt;properties-&amp;gt;urban = k_to_number($matches[3]);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function k_to_number($data) {&lt;br /&gt;
    if (preg_match(&amp;#039;/([0-9]+)(\.([0-9])+)?K/&amp;#039;, $data, $matches)) {&lt;br /&gt;
        if (isset($matches[3])) {&lt;br /&gt;
            return $matches[1].$matches[3].&amp;#039;00&amp;#039;;&lt;br /&gt;
        } else {&lt;br /&gt;
            return $matches[1].&amp;#039;000&amp;#039;;&lt;br /&gt;
        }&lt;br /&gt;
    } else {&lt;br /&gt;
        return $data;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo json_encode($json, JSON_PRETTY_PRINT);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tom</name></author>
	</entry>
</feed>