Get address information without Google Autocomplete Address.

Hi everyone,


First of all, thank you for helping me.


This is not about Google Autocomplete Address. I need to do everything by maual.

I have a question about address information. I want to add a customer or an employee and I want to keep their information of address.

My database has Country, City, District, Neighborhood and Street attributes as text type. For example ; There is a customer and I want to keep his information of address. I want to see the whole country names at a country combobox. After when I choose a country name from the combobox, the whole city names will filter according to that country name. The rest of all attributes will follow the same way.

For example ; If I choose Spain from the country combobox, I should see Madrid, Barcelona... at city combobox.

There are a lot of country, city names. I cannot write whole of them to a database. I thought I could fetch these informations from google map but I couldn't. 

I don't want to see a map or something. I only need that my comboboxs are filled with country names, city names.

Is it possible ? if it is, How can I do that ?

 

Thank you.

If you are after something upto street address google location autocomplete APIs are the best bet. We even have a forge component around it. But its Licensed.


Another good alternative if you are just after Country-State-City names would be geonames. They have a forge component for it too. 


Hope this helps! 

You can insert in your database a list of countries and a list of cities with countries (country id). 

After it, on the screen, you set 2 combo boxes with each list and you create an on change action (with an ajax refresh on the cities combo box) for the first one that will filter the cities's list according to the country.

Hope it helps!

Solution

Hello Emre,

There are a number of options.  For Countries and States, you might find the location plugin useful.

There are plenty of online APIs for this information. Here are some

http://geodb-cities-api.wirefreethought.com/

https://public.opendatasoft.com/explore/dataset/worldcitiespop/api

https://www.geodatasource.com/web-service/location-search

Just be sure to check for latency from where your users or your server will be located depending on whether you plan to call the API from client or server side.

For city data there are a number of open source options. Major cities are around 12k records about 1MB, so the data size is relatively small. Try these

https://simplemaps.com/data/world-cities "Prominent" cities are free, for more detail, there is a small fee.

https://datahub.io/core/world-cities "Major" cities of the world.

But then you have to keep your database up to date.

I hope this helps.

Kind regards,

Stuart

Solution

Hi Emre,

Is your application public-facing, or will it be internal? I ask because you could consider a self-service model to this data - instead of starting with every city in your database, you could let the user create a new City on demand if he can't find it in the dropdown - it would start out empty, and users would add them as they require them. Or you could do this and still bootstrap your data with one of the lists that Stuart mentions.