GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Query used for searching string with city and state name  XML
Forum Index -> General
Author Message
sushil



Joined: 07/12/2009 06:28:52
Messages: 2
Offline

Hi Everyone,

I imported the mysql dump provided by the site. Thanks a bunch for making it easy.

I am trying to implement a function that will take a input given by the user and return the lat, long for that string.

The string might be "San Francisco, ca" or "San Francisco CA".

What is the best way to write a query on the geoname table to search for the above strings. I see that the name column only includes "San Francisco" while the admin1 column contains "CA" string.

Any suggestions are welcome.
Thanks in advance,
Sushil
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

If this is the only format you allow and if it is exactly city name and state code then you can parse the query string and query the database on the placename and the admin1code columns.

For user input this is normally not flexible enough and you will have to implement a full text search or use the GeoNames search web service.

Best

Marc

[WWW]
sushil



Joined: 07/12/2009 06:28:52
Messages: 2
Offline

Thanks for the info Marc. Implementing a full text search is painful and I will pretty much hit the search webservice limit very soon. I guess i will have to search for some other alternative.

Thanks anyways.
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team