Mobile app version of vmapp.org
Login or Join
Kaufman445

: Where do you get data to populate a suggest-box with Country, State, City and Zip Information? I'm trying to create some dialogs in my web-app that can auto-suggest possible Countries, States,

@Kaufman445

Posted in: #Forms #Geolocation

I'm trying to create some dialogs in my web-app that can auto-suggest possible Countries, States, Cities and Zips in a form.

I was planning on storing this information in a database, and making calls to it from AJAX as the user types.

I don't want anything overly complicated like the Geonames database that I was offered when I asked this question over at the GIS stackexchange.

I installed the Geonames database on my mysql server, but I found that it was more like points on the map (things like schools, stores etc) than it was just individual Countries, States, Cities and Zipcodes.

Please let me know if I am oversimplifying the problem, as it's entirely possible that I am.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Kaufman445

3 Comments

Sorted by latest first Latest Oldest Best

 

@Chiappetta492

It seems like you want a valid, accurate address from the user. Each country varies widely, but in the USA, the USPS maintains a current database of valid addresses, and everything you can possibly imagine about them. Vendors of proper address verification products (that can validate and standardize wrong/incomplete addresses) are CASS-Certified by the USPS.

There are a few options for doing what you want to do. The easiest of all, and most affordable (even free) is an address validation API. I work at a company called SmartyStreets which offers such an API called LiveAddress. There's a simple Javascript implementation you can just copy+paste into your website. As the user submits the form, they'll be prompted to choose a valid address based on what they typed. I am sure this will be of some use to you.

10% popularity Vote Up Vote Down


 

@Sims2060225

This blog post on a Coldfusion blog explains one implementation of what I think you're trying to do. It's pretty straight forward:


He found a cheap paid (regularly updated) source that provides their app with up-to-date city/zip/state/geo-coordinate records and imported it into an SQL database.
He created a user-defined function that would measure the distance between two sets of long/lat coordinates.
Then use the UDF to perform queries to find locations within a particular distance or check the distance between two locations.

10% popularity Vote Up Vote Down


 

@Vandalay111

One source is MaxMind. I haven't looked at their data, so I can comment on how good it is.

You will still need to make a decision about what to do if the exising, real-world city is not in your database.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme