<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Messages posted by "pinhead84"]]></title>
		<link>http://forum.geonames.org/gforum/posts/listByUser/502.page</link>
		<description><![CDATA[Messages posted by "pinhead84"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Re:Import GeoNames dump into Postgres</title>
				<description><![CDATA[ Hi Marc,

<p></p>

		<cite>marc wrote:</cite><br>
		<blockquote>These countries are available, only the geonameId is missing in the countryInfo. You could add the geonameId to your list above and I will add it then to the countryInfo.txt file.&nbsp;
		</blockquote>

I tried to check the broken relations between <b>countryInfo</b> and <b>geoname</b> tables, but had some problems finding out the corresponding <b>geoname</b>-tupels. I would suggest to use the following relations:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
AS =&gt; geonameid=5880801; fclass=A; fcode=ADMD; name=American Samoa, Territory of
BV =&gt; geonameid=3371123; fclass=A; fcode=PCLD; name=Bouvet Island
FO =&gt; geonameid=2622320; fclass=A; fcode=ADM1; name=Faroe Islands
GF =&gt; geonameid=3381670; fclass=A; fcode=ADM1; name=Department of Guiana
GU =&gt; geonameid=4043988; fclass=A; fcode=ADMD; name=Territory of Guam
MP =&gt; geonameid=4041467; fclass=A; fcode=ADMD; name=Northern Islands
MQ =&gt; geonameid=3570311; fclass=A; fcode=ADM1; name=Department of Martinique
NC =&gt; geonameid=2139685; fclass=A; fcode=ADM1; name=Territory of New Caledonia and Dependencies
PM =&gt; geonameid=3424932; fclass=A; fcode=ADM1; name=Territorial Collectivity of Saint Pierre and Miquelon
RE =&gt; geonameid=935317;  fclass=A; fcode=ADM1; name=Department of Reunion
SJ =&gt; geonameid=607072;  fclass=A; fcode=ADM1; name=Svalbard
UM =&gt; geonameid=5854968; fclass=A; fcode=ADMD; name=United States Minor Outlying Islands
VI =&gt; geonameid=4796775; fclass=A; fcode=ADMD; name=Virgin Islands of the United States
WF =&gt; geonameid=4034749; fclass=A; fcode=ADM1; name=Territory of the Wallis and Futuna Islands</pre>
		</div>

Because I'm relative new to the DB-structure of GeoNames, I've added the corresponding fclass and fcode fields to my listing. Is it correct, that "fclass=A" is a condition for this relations? - All the other relations between <b>countryInfo</b> and <b>geoname</b> (e.g. Germany) always have "fclass=A". Please correct me, if I misunderstood something. ;)

Assuming that I'm right, the following <b>countryinfo</b>-entries can not be related correctly to the <b>geoname</b>-table:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
AQ =&gt; no entry in geoname-table &#40;WHERE country='AQ' AND fclass='A'&#41;
AX =&gt; no entry in geoname-table &#40;WHERE country='AX'&#41;
HM =&gt; no entry in geoname-table &#40;WHERE country='HM'&#41;</pre>
		</div>

These entries still relate to geonameid=0, so I still need the dummy-entry in the <b>geoname</b>-table to ensure a valid Foreign-Key-Constraint. Is it possible to create the corresponding entries in the <b>geoname</b>-table?

<p></p>

		<cite>andy wrote:</cite><br>
		<blockquote>On the <b>alternatename</b>-table the problem can't be fixed so easy. I'll try to find out the corrupted tupels and will tell them to you on this thread.&nbsp;
		</blockquote>

I've written a small Java-tool to check the broken relations on the <b>alternatename</b>-table. It found 245 geonameid's, that don't exist in the <b>geoname</b>-table (anymore?). I attach the validation-result to this posting. 

If you're interested, I would send you the tool including (GPL'ed) source-code.


Greetz


Andy]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/preList/67/2715.page#2715</guid>
				<link>http://forum.geonames.org/gforum/posts/preList/67/2715.page#2715</link>
				<pubDate><![CDATA[Fri, 24 Aug 2007 16:26:17]]> GMT</pubDate>
				<author><![CDATA[ pinhead84]]></author>
			</item>
			<item>
				<title>Aw:No postal codes in database dump</title>
				<description><![CDATA[ Hello,

problem solved, you don't need to send the postalcodes again.
I've found the mail you send to me some month ago. ;)

Greetz


Andy]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/preList/7/2708.page#2708</guid>
				<link>http://forum.geonames.org/gforum/posts/preList/7/2708.page#2708</link>
				<pubDate><![CDATA[Thu, 23 Aug 2007 19:31:22]]> GMT</pubDate>
				<author><![CDATA[ pinhead84]]></author>
			</item>
			<item>
				<title>Re:Import GeoNames dump into Postgres</title>
				<description><![CDATA[ Hello Marc,

thanks for your quick answer. 

<p></p>

		<cite>marc wrote:</cite><br>
		<blockquote>You could help us sort out the missing or wrong geonameIds in the countryInfo file.&nbsp;
		</blockquote>

One simple problem on <b>countryinfo</b>-Table:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>SELECT * FROM countryinfo WHERE geonameid=0;</pre>
		</div>

Brings up 17 tupels with the following iso_alpha2:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
AQ
AS
AX
BV
FO
GF
GU
HM
MP
MQ
NC
PM
RE
SJ
UM
VI
WF</pre>
		</div>

If these countries aren't available on the <b>geoname</b>-table, I would suggest to create a dummy-entry with "geonameid=0".

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>INSERT INTO geoname &#40;geonameid&#41; VALUES &#40;0&#41;;</pre>
		</div>

After this modification, the foreign-key on <b>countryinfo</b> is set up correctly:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>ALTER TABLE ONLY countryinfo
    ADD CONSTRAINT fk_geonameid FOREIGN KEY &#40;geonameid&#41; REFERENCES geoname&#40;geonameid&#41;;</pre>
		</div>

On the <b>alternatename</b>-table the problem can't be fixed so easy. I'll try to find out the corrupted tupels and will tell them to you on this thread.

Greetz


Andy]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/preList/67/2707.page#2707</guid>
				<link>http://forum.geonames.org/gforum/posts/preList/67/2707.page#2707</link>
				<pubDate><![CDATA[Thu, 23 Aug 2007 19:10:36]]> GMT</pubDate>
				<author><![CDATA[ pinhead84]]></author>
			</item>
			<item>
				<title>Re:Import GeoNames dump into Postgres</title>
				<description><![CDATA[ Hello,

thanks a lot for your documentation.
I've found some issues, you can possibly fix in your documentation

<b>countryInfo.txt</b> contains two more fields:
currency =>  character(3),
geonameid =>  integer NOT NULL

No Primary Keys are defined, i've used the following ones:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>ALTER TABLE ONLY alternatename
    ADD CONSTRAINT pk_alternatenameid PRIMARY KEY &#40;alternatenameid&#41;;

ALTER TABLE ONLY geoname
    ADD CONSTRAINT pk_geonameid PRIMARY KEY &#40;geonameid&#41;;

ALTER TABLE ONLY countryinfo
    ADD CONSTRAINT pk_iso_alpha2 PRIMARY KEY &#40;iso_alpha2&#41;;</pre>
		</div>

I wasn't able to define Foreign-Keys for the <b>geonameid</b> on the tables <b>alternatename</b> and <b>countryinfo</b>. The data seems to be inconsistent on some tupels. So I decided to use the following indices:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
CREATE INDEX index_countryinfo_geonameid ON countryinfo USING hash &#40;geonameid&#41;;

CREATE INDEX index_alternatename_geonameid ON alternatename USING hash &#40;geonameid&#41;;</pre>
		</div>

Maybe you know a better solution?

Greetings


Andy]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/preList/67/2701.page#2701</guid>
				<link>http://forum.geonames.org/gforum/posts/preList/67/2701.page#2701</link>
				<pubDate><![CDATA[Thu, 23 Aug 2007 17:57:53]]> GMT</pubDate>
				<author><![CDATA[ pinhead84]]></author>
			</item>
	</channel>
</rss>