Link to home
Start Free TrialLog in
Avatar of CegerXun
CegerXun

asked on

I need the name of all countries and cities

Hi there,

As seen on title I need the name of all countries and cities around the world. I must use that in my application with selection box.

Could you please guide me how to achieve this issue?
Avatar of Shanmuga Sundaram D
Shanmuga Sundaram D
Flag of India image

if you are ready to purchase the database then try in http://www.geodatasource.com/
FYI they are providing some free edition in http://www.geodatasource.com/cities-free.html
Avatar of CegerXun
CegerXun

ASKER

i think you misunderstood me. i need their names in any data file like xml. because i will use them in my app.  i dont need their geographical datas i just need their names. but it must be for free. i am not ready for purchase.
ASKER CERTIFIED SOLUTION
Avatar of Shanmuga Sundaram D
Shanmuga Sundaram D
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you for your interest. i really appreciate it.
I worked for you. I will say how I did it convert the text file to xml. First I downloaded the Zip from the above said link for free. Then I extracted the files GEODATASOURCE-CITIES-FREE.TXT and GEODATASOURCE-COUNTRY.TXT from the zip. Then I opened MSAccess. There I imported the above two files and saved it as separate tables. Then I created a relation ship and then created a query to insert into a new table named "citydetails" that consists only the countrycode, countryname and city name.
Then I used VB6 to convert the citydetails tables records and store it into xml. The code goes as given below.

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\shanmugasundaram\My Documents\db1.mdb;Persist Security Info=False"
rs.CursorLocation = adUseClient
rs.Open "Select * from citydetails", cn, adOpenKeyset, adLockOptimistic
rs.Save "c:\city.xml", adPersistXML
MsgBox "finished"
End Sub

Finally I zipped that file and now stored via http://www9.sendthisfile.com. You can find the zipped file in this link that consists of the XML data. Please note, it takes more time to open since its size is nearly 10MB.

http://www9.sendthisfile.com/d.jsp?t=7e4wUVjpWLR81b1BS0nrZYRh

I tried my best to help you. Thanks for your points.