<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Forcing postal codes to reference geoname_id?"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/7.page</link>
		<description><![CDATA[Latest messages posted in the topic "Forcing postal codes to reference geoname_id?"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Forcing postal codes to reference geoname_id?</title>
				<description><![CDATA[ I posted <a href="http://forum.geonames.org/gforum/posts/list/957.page" target="_new" rel="nofollow">another topic</a> in another forum here, but it really relates to one goal I have in mind.  Instead of having location data in my geonames table AND my postal_codes table, I'd rather have my postal_codes table structured as follows:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>CREATE TABLE `postal_codes2` &#40;
    `country_code` CHAR&#40;2&#41; NOT NULL,
    `postal_code` VARCHAR&#40;10&#41; NOT NULL,
    `geoname_id` INT&#40;10&#41; UNSIGNED NOT NULL,
    PRIMARY KEY &#40;`country_code`, `postal_code`&#41;
&#41;;</pre>
		</div>

Now I think I've set up my INSERT statement correctly for US postal codes only so far, but I need to verify that I'm doing it correctly (see my <a href="http://forum.geonames.org/gforum/posts/list/957.page" target="_new" rel="nofollow">other post</a> for details on this specific concern).  I also would like to make it work for non-US postal codes (e.g.: CA); however, the select statement I used for US doesn't seem to work due to issues with admin code data.

Here's what I tried so far: (be warned, this query took 20 minutes)

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>INSERT INTO `postal_codes2` &#40;`country_code`, `postal_code`, `geoname_id`&#41;
  SELECT p.`country_code`, p.`postal_code`, g.`id`
  FROM `postal_codes` p, `geonames` g
    WHERE p.`country_code` = g.`country_code`
    AND p.`place_name` = g.`name`
    AND p.`admin_code1` = g.`admin1_code`
    AND g.`feature_class` = 'P'
    AND g.`feature_code` = 'PPL'
    AND p.`country_code` = 'US'
    GROUP BY p.`country_code`, p.`postal_code`;</pre>
		</div>

The GROUP BY was used to resolve my original issue linked above.  However, that doesn't mean it is the *right* way to do it.  Has anyone tried anything similar to this rather than managing two tables worth of data?  If so, care to share your process for creating the tables and inserting the data?]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/958.page#4262</guid>
				<link>http://forum.geonames.org/gforum/posts/list/958.page#4262</link>
				<pubDate><![CDATA[Thu, 3 Jul 2008 03:57:02]]> GMT</pubDate>
				<author><![CDATA[ mhuggins]]></author>
			</item>
			<item>
				<title>Re:Forcing postal codes to reference geoname_id?</title>
				<description><![CDATA[ We are also trying to match postal code places with the toponyms from the main GeoNames database. Our goal is to have only one database. To have a seperate postal code download as we have now is not our goal, we want to unify the two databases.
As you say this is far from trivial and I don't believe it can be solved with a simple sql statement. We are using algorithms which look at the names in different languages, look for similar names (names are not always spellt exactly the same way), looking at the distance, feature code etc.


Best

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/958.page#4265</guid>
				<link>http://forum.geonames.org/gforum/posts/list/958.page#4265</link>
				<pubDate><![CDATA[Thu, 3 Jul 2008 06:30:30]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:Forcing postal codes to reference geoname_id?</title>
				<description><![CDATA[ Thanks for the response, marc, I greatly appreciate your input.  I didn't realize this was an intended goal of the project.  I definitely lack enough familiarity with geocoding to be able to perform what you describe here.  I look forward to any updates that help progress Geonames in that direction!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/958.page#4266</guid>
				<link>http://forum.geonames.org/gforum/posts/list/958.page#4266</link>
				<pubDate><![CDATA[Thu, 3 Jul 2008 11:36:54]]> GMT</pubDate>
				<author><![CDATA[ mhuggins]]></author>
			</item>
			<item>
				<title>Re:Forcing postal codes to reference geoname_id?</title>
				<description><![CDATA[ I'm very interesting to associate all the postalcode with the geonameid.

Do you have an idea when it will be available ?

Thank's.

Best Regard]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/958.page#4341</guid>
				<link>http://forum.geonames.org/gforum/posts/list/958.page#4341</link>
				<pubDate><![CDATA[Wed, 16 Jul 2008 10:57:10]]> GMT</pubDate>
				<author><![CDATA[ patou]]></author>
			</item>
			<item>
				<title>Re:Forcing postal codes to reference geoname_id?</title>
				<description><![CDATA[ Hi Patou, I have no idea when it will be available, but certainly not anytime soon. I simply don't have time to work on it right now.

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/958.page#4506</guid>
				<link>http://forum.geonames.org/gforum/posts/list/958.page#4506</link>
				<pubDate><![CDATA[Sun, 17 Aug 2008 17:39:38]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:Forcing postal codes to reference geoname_id?</title>
				<description><![CDATA[ Something very usefull to help matching zipcodes to geonameids would be to use the same admin codes in the zip dump and in the main dump (country code is ok, but admin1 and admin2 are different, event names are different).

Lou]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/958.page#4619</guid>
				<link>http://forum.geonames.org/gforum/posts/list/958.page#4619</link>
				<pubDate><![CDATA[Mon, 8 Sep 2008 17:01:49]]> GMT</pubDate>
				<author><![CDATA[ Lou]]></author>
			</item>
			<item>
				<title>Re:Forcing postal codes to reference geoname_id?</title>
				<description><![CDATA[ Lou

This is true it would be easier with the exact spelling. Do you want to help us with this?

Thanks.

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/958.page#4627</guid>
				<link>http://forum.geonames.org/gforum/posts/list/958.page#4627</link>
				<pubDate><![CDATA[Tue, 9 Sep 2008 21:34:56]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:Forcing postal codes to reference geoname_id?</title>
				<description><![CDATA[ Do you have an idea how I can associate a postal code with a geonameid ?

Thank's]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/958.page#4988</guid>
				<link>http://forum.geonames.org/gforum/posts/list/958.page#4988</link>
				<pubDate><![CDATA[Tue, 18 Nov 2008 20:43:13]]> GMT</pubDate>
				<author><![CDATA[ patou]]></author>
			</item>
	</channel>
</rss>