<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "How to import the cities data into postgres?"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "How to import the cities data into postgres?"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>How to import the cities data into postgres?</title>
				<description><![CDATA[ Hi there,

I tried (in vain) to import the cities data (> 15000) into a postgres database.

Created first the table (guessed the structure):

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>create table geonames_cities &#40;
         geonameid int,
         countrycode varchar&#40;3&#41;,
         fcode varchar&#40;5&#41;,
         fcodeName varchar&#40;200&#41;,
         fcl varchar&#40;2&#41;,
         fclName varchar&#40;100&#41;,
         name varchar&#40;200&#41;,
         wikipedia varchar&#40;100&#41;,
         lng float,
         lat float,
         population int
 &#41;; </pre>
		</div>

Then, tried to import the txt file:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>\copy geonames_cities &#40;population, name, fclName, lat, lng, fcl, fcode, countrycode, geonameID&#41; from 'cities15000.txt' null as ''</pre>
		</div>

But it doesn't work....

Can anyone give me the correct command our a hint what I am doing wrong?

Thanks a lot!

<span style="font-size: 9px; line-height: normal">____________________________________________________________________
  
  Lean Back and Relax - Enjoy some Nature Photography
  http://photoblog.la-famille-schwarzer.de

  Appetite for Global Data? UNEP GEO Data Portal:  
  http://geodata.grid.unep.ch
  ____________________________________________________________________</span>]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1211.page#5172</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1211.page#5172</link>
				<pubDate><![CDATA[Mon, 12 Jan 2009 12:33:58]]> GMT</pubDate>
				<author><![CDATA[ luftikus143]]></author>
			</item>
			<item>
				<title>Re:How to import the cities data into postgres?</title>
				<description><![CDATA[ Hi

There is an faq entry about loading the data into postgres:
http://forum.geonames.org/gforum/posts/list/67.page

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1211.page#5175</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1211.page#5175</link>
				<pubDate><![CDATA[Tue, 13 Jan 2009 07:48:08]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:How to import the cities data into postgres?</title>
				<description><![CDATA[ Yes, I've seen that and tried to let me guide as much as I can. But there is no mentioning of cities data/format. And the \copy doesn't work... Any "restore" way of importing the data?]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1211.page#5177</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1211.page#5177</link>
				<pubDate><![CDATA[Tue, 13 Jan 2009 07:54:34]]> GMT</pubDate>
				<author><![CDATA[ luftikus143]]></author>
			</item>
			<item>
				<title>Re:How to import the cities data into postgres?</title>
				<description><![CDATA[ The 'cities' files are just excerpts from the geoname table. The dataformat is identical.

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1211.page#5178</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1211.page#5178</link>
				<pubDate><![CDATA[Tue, 13 Jan 2009 08:02:27]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:How to import the cities data into postgres?</title>
				<description><![CDATA[ But then I don't understand why the field names are different. 

fcl (cities) equals fclass (geoname) ?
fcodename (cities) equals ?
fclname (cities) equals ?
wikipedia (cities) equals ?

This is perhaps a bit dumb from my side, but I find it strange that it needs hours from the users' side to understand format and structure of the tables, before being able to import the stuff. You're doing a great job, right! Just to hint that perhaps one could add the CREATE TABLE etc. stuff for MySQL and Postgres somewhere in the download directory or directly in the dump file.

Sorry for any signs of incompetence from my side... :-)

Great work!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1211.page#5179</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1211.page#5179</link>
				<pubDate><![CDATA[Tue, 13 Jan 2009 15:00:19]]> GMT</pubDate>
				<author><![CDATA[ luftikus143]]></author>
			</item>
	</channel>
</rss>