<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Good autocompletion service needed"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "Good autocompletion service needed"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Good autocompletion service needed</title>
				<description><![CDATA[ 
Hi guys,

I've tested http://www.geonames.org/export/ajax-postalcode-autocomplete.html quite a bit today and I find it incredibly slow :(
Why is that?

My problem is that I need to create an autocomplete text field like the one found on www.booking.com but I can't find something nearly efficient.

Could someone direct me to the proper direction?

Thanks a lot!
]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5210</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5210</link>
				<pubDate><![CDATA[Mon, 19 Jan 2009 19:13:58]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ too many users have been using the free services these days, which slowed the service down. Sorry.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5213</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5213</link>
				<pubDate><![CDATA[Mon, 19 Jan 2009 22:45:26]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ Why don't you host the database on your server and use that?

I needed to do something similar, but for place names (Globally).  I took the main geonames table and removed everything but P and A featurecode records.  I.E.  I removed mountains, rivers etc...  This still left almost 3 million records to search.  The user types into a textbox and after each keypress the database is queried for all record matching what the user has entered so far and displays the results.  Initially the search was taking 32 seconds.  Way too long.  I had a quick read up on indexes and such and managed to get the query time down to just 0.078 seconds.  This works pretty well.
Currently the database is on a test server (DebianLinux/apache/mysql/php) in a Virtual machine.  Once it's moved to the production server it should be faster still.

regards...]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5215</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5215</link>
				<pubDate><![CDATA[Mon, 19 Jan 2009 23:01:26]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ Of course, I'm willing to host the whole thing on my own server but on http://www.geonames.org/export/ajax-postalcode-autocomplete.html it says the following : 

<blockquote>The javascript file http://ws.geonames.org/export/geonamesData.js contains an array with all countries supported for this service and the country of the user's ip address. This file has to be downloaded from the geonames server, <b>don't host it on your own server</b> as it contains user specific data (user country). &nbsp;
		</blockquote>

Actually, I don't understand what they mean by "user" in that paragraph.

So, how am I supposed to do if I don't want to depend on geonames' servers?

Also, I only need to use countries, regions and cities. What files should I download then? I can't find files with region names on http://download.geonames.org/export/dump/

Thanks again for the help! :)]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5216</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5216</link>
				<pubDate><![CDATA[Tue, 20 Jan 2009 07:06:01]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ Hello?  :D ]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5233</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5233</link>
				<pubDate><![CDATA[Wed, 21 Jan 2009 11:03:49]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ I had a quick look around and it seems the postal codes dump you would need, is not readily available.  I wasn't aware of this as I didn't need that data myself.

I found this:

Drop an email to info@geonames.org if you need the postal code dump file. (And if you are not a spammer   )

That might be a good place to start.  You won't get far with no postal code data to work with.   :lol: 

How you proceed after that depends on what you're familiar with.

For me, Javascript would monitor the textbox input and talk to the server via ajax.   php on the server would query the postcode database, returning the results back to the browser for dynamic update.

Regards.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5239</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5239</link>
				<pubDate><![CDATA[Wed, 21 Jan 2009 18:51:51]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ Thanks terry :)

No, I'm not a spammer!

As for the method, after a long thought, I'd prefer to use only select menus in order to totally avoid user inputs.  

So, there would be one select menu for the country, one for the postal codes and one for the city. Each of the last two ones would be updated in accordande to the previous selection.

Do you think it is a good plan?

Thanks again for the help :)
]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5246</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5246</link>
				<pubDate><![CDATA[Wed, 21 Jan 2009 22:31:46]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ You can implement it any way you feel comfortable doing it.
So you would select options from list menus:

Country > City > postcode ??

What, if like me you don't live in a city?

The original direction of this topic was "auto complete".

Personally, I would still go with auto complete, as it avoids situations where a user would not come under the umbrella of a particular city.
You would be using ajax anyway to populate your 2nd and 3rd listboxes, so you'd have most of the code there already.  If you can get the queries fast enough, it could mean less code to write and it's more flexible for your users.  It depends on what fields the postcode table has, but I would try just a "Select Country" listbox, then a textbox and run auto complete queries on the server based on that, limiting the search to just that country code to help speed up the query.  Indexes on the postcode field and country code field, (assuming there is one), should help a lot.

You could even have your original 3 listboxes, and if they cannot find their postcode from that, offer an auto complete box.

Maybe just suck it and see what works best.  Either option only requires simple minimal code at the client and server ends.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5247</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5247</link>
				<pubDate><![CDATA[Wed, 21 Jan 2009 22:56:05]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ One other thing....

I'm definitely not an expert in ajax, php, mysql, or java script.
I've learn't how to do what I've needed to do, when I've needed to do it.
Websites etc, are pretty much just a hobby for me.
I'd take anything I say with a pinch of salt.  I'm just trying to help out with some suggestions based on my own experience with similar stuff.
It would be well worth getting a second opinion if I were you.  :) 

Just trying to be helpful.   :D ]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5248</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5248</link>
				<pubDate><![CDATA[Wed, 21 Jan 2009 23:05:50]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ Thanks :)

Yeah, I wanted to do autocomplete but I thought that, if I let users enter city names in the database, I could end up with mistaken and non-standardized data that I would have to check. That wouldn't be good for the search function that I also have to implement.

But autocomplete could remain a good option if only the proposed choices could be entered in the database. I could make the city field optional for those whose city isn't listed, the postal code being enough.

What do you think?
Also, how many MB would the total dump file be? (countries, codes and cities)

PS : no problem if you're not an expert ... as long as it comes from practical experience :)]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5249</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5249</link>
				<pubDate><![CDATA[Wed, 21 Jan 2009 23:11:51]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ Users should not be able to enter what they actually typed, into the database, but instead get a list of actual names displayed, based on what they typed.  They then pick one of these preselected standard names.
That way your data stays standardized.

I'm not too sure what your goal is here.  I thought you wanted every user to pick a postcode as this is more precise than just a city, but it seems you would be happy just to have their city listed with no postcode?

That's not all that relevant though.  I was just trying to get a feel for what you actually needed.

The dump I have here with the rivers, mountains etc removed is 490Mb uncompressed.  I still have tables in there that I don't use, and only removed some stuff to speed up queries a bit on tables that I actually use.  I'm not short on disk space so the unused tables are no bother.  My dump includes these tables:

Admin1codes
Admin1codes ASCII
Admin2codes
Alternate Names
Continent Codes
Country info
feature codes
geonames
iso language codes
time zones

I'm guessing you'll at least need to download:

allcountries.zip
countryinfo.txt
and
postal codes (If you can get it)

and possibly create the continent codes if you want to minimize the list of countries displayed in the listbox. There's 247 countries to pick from if you display them all in one list.

If you just get the data you need and delete any rows that will be redundant for your application, you can make the database much smaller than it would be by default.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5250</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5250</link>
				<pubDate><![CDATA[Wed, 21 Jan 2009 23:53:57]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ OK, I've downloaded the allCountries.txt, the one that makes 700mb uncompressed and it looks like SQLyog (community edition) can't take such a big file. 

How do you guys manage to import it in your database?

Thanks again :)]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5253</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5253</link>
				<pubDate><![CDATA[Thu, 22 Jan 2009 11:34:30]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ navicat and phpmyadmin work fine for me.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5258</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5258</link>
				<pubDate><![CDATA[Thu, 22 Jan 2009 20:02:34]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ I just got sqlyog community and that works just fine to import the 700Mb+ allCountries.txt file.
Took about 12 mins to import, but was straight forward.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5260</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5260</link>
				<pubDate><![CDATA[Thu, 22 Jan 2009 20:48:38]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ Hi Terry,

I've tried again with SQLyog but it doesn't work. The dialogue box "execute query from a file" seems to freeze and nothing happen in the progress bar even after 30 minutes.

Then, I've installed phpmyadmin and it says that it can't process dump files bigger than 84mb. Then I ran bigdump.php and it said it can't process files bigger than 200mb! :(

So, what's the secret?? ;)

Thanks again!

]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5270</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5270</link>
				<pubDate><![CDATA[Fri, 23 Jan 2009 19:02:21]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ This is how I did it from the query command

CREATE DATABASE geonames DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

use geonames;

CREATE TABLE geonames (
       geoname_id mediumint PRIMARY KEY,
       name varchar(200),
       ascii_name varchar(200),
       alternate_names varchar(4000),
       latitude decimal(10,7),
       longitude decimal(10,7),
       feature_class char(1),
       feature_code varchar(10),
       country_code varchar(2),
       cc2 varchar(60),
       admin1_code varchar(20),
       admin2_code varchar(80),
       admin3_code varchar(20),
       admin4_code varchar(20),
       population mediumint,
       elevation int,
       gtopo30 smallint,
       time_zone varchar(40),
       modification_date date
) CHARACTER SET utf8;

SET CHARACTER SET utf8;

SET NAMES utf8;

LOAD DATA LOCAL INFILE 'Drive:/path/to/allCountries.txt' INTO TABLE geonames (geoname_id, name, ascii_name, alternate_names, latitude, longitude, feature_class, feature_code, country_code, cc2, admin1_code, admin2_code, admin3_code, admin4_code, population, elevation, gtopo30, time_zone, modification_date);


Hope that helps]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5271</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5271</link>
				<pubDate><![CDATA[Fri, 23 Jan 2009 22:01:44]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ wow ... I don't know how I could thank you properly.
Your solution worked nicely and it took only 2 minutes to import the whole table! 

I really appreciate your help.

BTW, do you know why there are records that lack the country code?
For example, some korean place lack it I've noticed.

Thanks again ... really!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5272</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5272</link>
				<pubDate><![CDATA[Fri, 23 Jan 2009 22:40:22]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ I deleted all codes from geonames except for P and A, so I only have 16 entries left with no country_code.
These show up as places like NATO and the European Union.  These are administrative bodies that do not really apply to a country.
That's my guess anyway.  :) ]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5277</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5277</link>
				<pubDate><![CDATA[Sat, 24 Jan 2009 13:24:45]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ 
Hi Terry :)

I've had a deeper look at the data and I have concerns about the quality of the records. For example, all the french postal codes are stored in the column "alternate_names" ... which is not very handy.

Do you know what are the commercial databases so that I could compare?

Thanks again for your precious help.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5285</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5285</link>
				<pubDate><![CDATA[Sun, 25 Jan 2009 11:46:09]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ I can't really see any problem with the post code being under alternate names.  Here in the uk the prefix of a postcode is often used as an area name.  I can't say I've noticed any under alternate names, but then I'm not using the alternate names field, so that's not surprising.

I thought you were going to get the separate postal codes data and use that?

I have never used a commercial dataset for global location names etc...
It seems to me that such data should be in the public domain. I would guess that most data of this nature has to be provided by a government on some level, which means it's citizens have paid for it anyway.

I am a hobby user and have no interest in a commercial dataset.
To be honest, the commercial products probably get data from some of the same sources as geonames, not that I know, I'm just guessing.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5290</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5290</link>
				<pubDate><![CDATA[Sun, 25 Jan 2009 18:42:35]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ <p></p>

		<cite>terryh wrote:</cite><br>
		<blockquote>...
I thought you were going to get the separate postal codes data and use that?
....&nbsp;
		</blockquote>

The separate postal codes aren't the one common people use here.
The postal codes we use are the ones stored in alternate_names which means that the column for postal codes become useless for France.

Anyway, thanks again for your help :)]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5291</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5291</link>
				<pubDate><![CDATA[Sun, 25 Jan 2009 20:27:23]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ It's easy enough to extract just the postcode from the alternate_names field, for France.

It looks like the postcode always pre-ceeds any text and it's always 5 digits long.
There's a few ways you could extract the code easily.

Read off the first 5 chars from' alternate_name's and use a regular expression to match it against the postcode format.  The regular expression is even given in the country_info data.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5298</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5298</link>
				<pubDate><![CDATA[Mon, 26 Jan 2009 11:22:29]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ What is the data in the admin4 field?
That looks like postcodes too, but not the same numbers as in the alternate names field.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5299</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5299</link>
				<pubDate><![CDATA[Mon, 26 Jan 2009 11:25:44]]> GMT</pubDate>
				<author><![CDATA[ terryh]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ After some research, the codes in admin4 are in fact INSEE codes.
The real postal codes that everyone use in their daily lives are stored in alternate_names.

For example, the postal code for Creteil is 94000 but admin4 is set to 94028 which is the INSEE code.

http://www.geneawiki.com/index.php/94028_-_Cr%C3%A9teil
http://www.lescommunes.com/commune-creteil-94028.en.html

]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5300</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5300</link>
				<pubDate><![CDATA[Mon, 26 Jan 2009 11:42:01]]> GMT</pubDate>
				<author><![CDATA[ sleidia]]></author>
			</item>
			<item>
				<title>Re:Good autocompletion service needed</title>
				<description><![CDATA[ Is there a way that I can get the postal code regular expression from a web service call? :) :) :) :) :)]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1222.page#5317</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1222.page#5317</link>
				<pubDate><![CDATA[Thu, 29 Jan 2009 05:46:10]]> GMT</pubDate>
				<author><![CDATA[ MichaelDBang]]></author>
			</item>
	</channel>
</rss>