<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Geonames tree, parent/child relationship, problem with Athens/Greece"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "Geonames tree, parent/child relationship, problem with Athens/Greece"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Geonames tree, parent/child relationship, problem with Athens/Greece</title>
				<description><![CDATA[ Hey!

I use geonames DB locally.
For our program a world location tree is required.
To build a tree you need to find parent/child relationships in geonames DB.

To find parent of a city (Paris) I do the following.
1. find Paris id in geonames table: 2988507
2. take country_code: FR
3. take admin1_code: A8
4. take admin2_code: 75
5. compose a key from the codes "FR.A8.75"
6. The key enables me to find admin2 code in admin2Codes.txt table: 2968815 (D├йpartement de Ville-de-Paris)
The parent is 2968815
Nice!

Do I look for parent in a right way?
Pleas point me to a right direction if I'm wrong.

Unfortunately this algorithm does not work for some countries.
Greece is one of them.
When I look for parent for Athenes/Greece (264371) the following problem arises.
2. take country_code: GR
3. take admin1_code: [empty]
4. take admin2_code: 35
5. key: "GR..35"

There is no this key in admin2Codes.txt table
However there is this key
GR.ESYE31.35

Why ESYE31 missing for Athens in admin1_code in geonames table?
Is it error in the database or the DB is correct and I'm using it in a wrong way?


Thank you for the project!

Pavel Repkin
]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1567.page#6515</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1567.page#6515</link>
				<pubDate><![CDATA[Fri, 16 Oct 2009 18:43:13]]> GMT</pubDate>
				<author><![CDATA[ donald128]]></author>
			</item>
			<item>
				<title>Re:Geonames tree, parent/child relationship, problem with Athens/Greece</title>
				<description><![CDATA[ Hi

When i have coded <a href="http://www.gisgraphy.com" target="_new" rel="nofollow">Gisgraphy</a> i got the same question, i have coded an algorithm that try to detect adm by codes and try to correct (potential) errors. 

You can see the code <a href="http://www.gisgraphy.com/xref/com/gisgraphy/domain/repository/AdmDao.html#533" target="_new" rel="nofollow">here</a> or use the gisgraphy importer that inject geonames csv files into a postgres database in a tree structure

Hope it helps
David]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1567.page#6516</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1567.page#6516</link>
				<pubDate><![CDATA[Fri, 16 Oct 2009 23:24:30]]> GMT</pubDate>
				<author><![CDATA[ david masclet]]></author>
			</item>
			<item>
				<title>Re:Geonames tree, parent/child relationship, problem with Athens/Greece</title>
				<description><![CDATA[ I have added the missing adm1 codes for Greece, deriving them from the admin2 code. Do not use the algorithm David is suggesting if you don't want to have a lot of errors.

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1567.page#6525</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1567.page#6525</link>
				<pubDate><![CDATA[Sun, 18 Oct 2009 23:03:23]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:Geonames tree, parent/child relationship, problem with Athens/Greece</title>
				<description><![CDATA[ Hi

Marc is right, the algorithm is not sure.

I should have precise that the algorithm is based on some suppositions that are not always true. it is not determinist. The goal is tu run the algo and to manually check if the result is correct. it can save times but can loose too in an other way if the suppositions are not true.

i have check and the algo can't correct the error in this case.

David]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1567.page#6527</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1567.page#6527</link>
				<pubDate><![CDATA[Mon, 19 Oct 2009 10:58:20]]> GMT</pubDate>
				<author><![CDATA[ david masclet]]></author>
			</item>
			<item>
				<title>Re:Geonames tree, parent/child relationship, problem with Athens/Greece</title>
				<description><![CDATA[ Thank you Marc and David.
It works now - I can find admin1 for Athens and all other Greek locations!

]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1567.page#6529</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1567.page#6529</link>
				<pubDate><![CDATA[Mon, 19 Oct 2009 13:40:03]]> GMT</pubDate>
				<author><![CDATA[ donald128]]></author>
			</item>
	</channel>
</rss>