Ways to get the List of Countries and Cities

Discussion in 'ASP .Net' started by David Freeman, Mar 25, 2005.

  1. Hi There!

    I'm trying to create a User Registration page in ASP.NET and wondering what
    is the best way to get the list of up-to-date Countries and Cities? Are
    there any Web Services on the web that I can use to retrieve such
    information? If not, what are the options?

    Please, any suggestions and pointers will be very much appreciated!

    Dave
     
    David Freeman, Mar 25, 2005
    #1
    1. Advertising

  2. Peter Morris [Droopy eyes software], Mar 25, 2005
    #2
    1. Advertising

  3. Since this list does not get deprecated that soon, why not create your own
    web service/component? You can find a list at:

    http://www.answers.com/topic/list-of-capitals-and-larger-cities-by-country

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "David Freeman" <> wrote in message
    news:%23juUE%...
    > Hi There!
    >
    > I'm trying to create a User Registration page in ASP.NET and wondering

    what
    > is the best way to get the list of up-to-date Countries and Cities? Are
    > there any Web Services on the web that I can use to retrieve such
    > information? If not, what are the options?
    >
    > Please, any suggestions and pointers will be very much appreciated!
    >
    > Dave
    >
    >
     
    Manohar Kamath, Mar 25, 2005
    #3
  4. Why reinvent the wheel ?

    Use this free component :

    http://www.codeproject.com/aspnet/CountryCombo.asp

    This one only has countries, but you can easily add cities.

    You'll need to register with the Code Project
    in order to download the source code, but it's free.



    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Manohar Kamath" <> wrote in message
    news:...
    > Since this list does not get deprecated that soon, why not create your own
    > web service/component? You can find a list at:
    >
    > http://www.answers.com/topic/list-of-capitals-and-larger-cities-by-country
    >
    > --
    > Manohar Kamath
    > Editor, .netWire
    > www.dotnetwire.com



    > "David Freeman" <> wrote in message
    > news:%23juUE%...
    >> Hi There!
    >>
    >> I'm trying to create a User Registration page in ASP.NET and wondering

    > what
    >> is the best way to get the list of up-to-date Countries and Cities? Are
    >> there any Web Services on the web that I can use to retrieve such
    >> information? If not, what are the options?
    >>
    >> Please, any suggestions and pointers will be very much appreciated!
    >>
    >> Dave
     
    Juan T. Llibre, Mar 25, 2005
    #4
  5. Just looking at the article "Our control will populate the country names at
    design time" -- not sure if I would use such an app which is a maintenance
    nightmare. From the article I suggsted, once could just scrape the countries
    and cities, and create some data source.

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "Juan T. Llibre" <> wrote in message
    news:...
    > Why reinvent the wheel ?
    >
    > Use this free component :
    >
    > http://www.codeproject.com/aspnet/CountryCombo.asp
    >
    > This one only has countries, but you can easily add cities.
    >
    > You'll need to register with the Code Project
    > in order to download the source code, but it's free.
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > "Manohar Kamath" <> wrote in message
    > news:...
    > > Since this list does not get deprecated that soon, why not create your

    own
    > > web service/component? You can find a list at:
    > >
    > >

    http://www.answers.com/topic/list-of-capitals-and-larger-cities-by-country
    > >
    > > --
    > > Manohar Kamath
    > > Editor, .netWire
    > > www.dotnetwire.com

    >
    >
    > > "David Freeman" <> wrote in message
    > > news:%23juUE%...
    > >> Hi There!
    > >>
    > >> I'm trying to create a User Registration page in ASP.NET and wondering

    > > what
    > >> is the best way to get the list of up-to-date Countries and Cities? Are
    > >> there any Web Services on the web that I can use to retrieve such
    > >> information? If not, what are the options?
    > >>
    > >> Please, any suggestions and pointers will be very much appreciated!
    > >>
    > >> Dave

    >
    >
     
    Manohar Kamath, Mar 25, 2005
    #5
  6. heh, heh...

    Hi, Manohar.

    re:
    > not sure if I would use such an app
    > which is a maintenance nightmare.


    Why would you think it's "a maintenace nightmare" ?
    How many countries are created every year ?

    re:
    >Our control will populate the country names at design time


    Yup, and then it runs as a compiled assembly, in memory.

    You need to change something ? Add a country/city ?
    Change the source, recomplie, and you're good to go.

    No big deal.

    re:
    > once could just scrape the countries
    > and cities, and create some data source.


    Easier said than done, and you're still relying on changes
    which happen at some site whose html format might change,
    requiring a re-coding of the scrape.

    I think I'd rather modify the source for the control
    I suggested ( complete source is included ) to add
    the capital cities, and then use *that*.

    Updates could, still, be made by checking that list
    you suggest, but relying on a control made by yourself
    is bound to provide better results than relying on a page
    scrape which might change at an inconvenient time,
    or which might be unavailable for whatever reason.



    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Manohar Kamath" <> wrote in message
    news:...
    > Just looking at the article "Our control will populate the country names
    > at
    > design time" -- not sure if I would use such an app which is a maintenance
    > nightmare. From the article I suggsted, once could just scrape the
    > countries
    > and cities, and create some data source.
    >
    > --
    > Manohar Kamath
    > Editor, .netWire
    > www.dotnetwire.com



    > "Juan T. Llibre" <> wrote in message
    > news:...
    >> Why reinvent the wheel ?
    >>
    >> Use this free component :
    >>
    >> http://www.codeproject.com/aspnet/CountryCombo.asp
    >>
    >> This one only has countries, but you can easily add cities.
    >>
    >> You'll need to register with the Code Project
    >> in order to download the source code, but it's free.
    >>
    >> Juan T. Llibre
    >> ASP.NET MVP
    >> http://asp.net.do/foros/
    >> Foros de ASP.NET en Español
    >> Ven, y hablemos de ASP.NET...
    >> ======================


    >> "Manohar Kamath" <> wrote in message
    >> news:...
    >> > Since this list does not get deprecated that soon, why not
    >> > create your own web service/component? You can find a list at:
    >> >

    > http://www.answers.com/topic/list-of-capitals-and-larger-cities-by-country
    >> >
    >> > --
    >> > Manohar Kamath
    >> > Editor, .netWire
    >> > www.dotnetwire.com

    >>
    >>
    >> > "David Freeman" <> wrote in message
    >> > news:%23juUE%...
    >> >> Hi There!
    >> >>
    >> >> I'm trying to create a User Registration page in ASP.NET and wondering
    >> > what
    >> >> is the best way to get the list of up-to-date Countries and Cities?
    >> >> Are
    >> >> there any Web Services on the web that I can use to retrieve such
    >> >> information? If not, what are the options?
    >> >>
    >> >> Please, any suggestions and pointers will be very much appreciated!
    >> >>
    >> >> Dave

    >>
    >>

    >
    >
     
    Juan T. Llibre, Mar 25, 2005
    #6
  7. > Why would you think it's "a maintenace nightmare" ?

    Nothing against the code, but anything that is hard-coded is maintenance
    risk -- if not in the immediate future, but soon thereafter. Plus, it is
    adds to the inflexibility. Consider that you want to share the data with
    another app, but you want to add new attributes like population, area, etc.
    Doing so would require not only changing the data, but also changing the
    app, with recompile. That would also mean the clients of the app need to
    change, or you have to create a new version to cater to the new requirement.

    > Easier said than done, and you're still relying on changes
    > which happen at some site whose html format might change,
    > requiring a re-coding of the scrape.


    I didn't mean to use the site itself a data source, just that there was a
    list of countries and cities, and the person could scrape that list to
    create a data souce -- XML file, database, etc.

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "Juan T. Llibre" <> wrote in message
    news:...
    > heh, heh...
    >
    > Hi, Manohar.
    >
    > re:
    > > not sure if I would use such an app
    > > which is a maintenance nightmare.

    >
    > Why would you think it's "a maintenace nightmare" ?
    > How many countries are created every year ?
    >
    > re:
    > >Our control will populate the country names at design time

    >
    > Yup, and then it runs as a compiled assembly, in memory.
    >
    > You need to change something ? Add a country/city ?
    > Change the source, recomplie, and you're good to go.
    >
    > No big deal.
    >
    > re:
    > > once could just scrape the countries
    > > and cities, and create some data source.

    >
    > Easier said than done, and you're still relying on changes
    > which happen at some site whose html format might change,
    > requiring a re-coding of the scrape.
    >
    > I think I'd rather modify the source for the control
    > I suggested ( complete source is included ) to add
    > the capital cities, and then use *that*.
    >
    > Updates could, still, be made by checking that list
    > you suggest, but relying on a control made by yourself
    > is bound to provide better results than relying on a page
    > scrape which might change at an inconvenient time,
    > or which might be unavailable for whatever reason.
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > "Manohar Kamath" <> wrote in message
    > news:...
    > > Just looking at the article "Our control will populate the country names
    > > at
    > > design time" -- not sure if I would use such an app which is a

    maintenance
    > > nightmare. From the article I suggsted, once could just scrape the
    > > countries
    > > and cities, and create some data source.
    > >
    > > --
    > > Manohar Kamath
    > > Editor, .netWire
    > > www.dotnetwire.com

    >
    >
    > > "Juan T. Llibre" <> wrote in message
    > > news:...
    > >> Why reinvent the wheel ?
    > >>
    > >> Use this free component :
    > >>
    > >> http://www.codeproject.com/aspnet/CountryCombo.asp
    > >>
    > >> This one only has countries, but you can easily add cities.
    > >>
    > >> You'll need to register with the Code Project
    > >> in order to download the source code, but it's free.
    > >>
    > >> Juan T. Llibre
    > >> ASP.NET MVP
    > >> http://asp.net.do/foros/
    > >> Foros de ASP.NET en Español
    > >> Ven, y hablemos de ASP.NET...
    > >> ======================

    >
    > >> "Manohar Kamath" <> wrote in message
    > >> news:...
    > >> > Since this list does not get deprecated that soon, why not
    > >> > create your own web service/component? You can find a list at:
    > >> >

    > >

    http://www.answers.com/topic/list-of-capitals-and-larger-cities-by-country
    > >> >
    > >> > --
    > >> > Manohar Kamath
    > >> > Editor, .netWire
    > >> > www.dotnetwire.com
    > >>
    > >>
    > >> > "David Freeman" <> wrote in message
    > >> > news:%23juUE%...
    > >> >> Hi There!
    > >> >>
    > >> >> I'm trying to create a User Registration page in ASP.NET and

    wondering
    > >> > what
    > >> >> is the best way to get the list of up-to-date Countries and Cities?
    > >> >> Are
    > >> >> there any Web Services on the web that I can use to retrieve such
    > >> >> information? If not, what are the options?
    > >> >>
    > >> >> Please, any suggestions and pointers will be very much appreciated!
    > >> >>
    > >> >> Dave
    > >>
    > >>

    > >
    > >

    >
    >
     
    Manohar Kamath, Mar 25, 2005
    #7
  8. re:
    > anything that is hard-coded is maintenance risk


    And, presumably, something which isn't hard-coded,
    but -instead- relies on some other method isn't ?

    re:
    >you want to add new attributes like population, area


    That wan't the problem posed, though.

    This is a simple country/city dropdown list,
    which you can reuse in a number of apps, Manohar.

    Tell me something, regarding :

    > I didn't mean to use the site itself a data source,
    > just that there was a list of countries and cities,
    > and the person could scrape that list to create a
    > data source -- XML file, database, etc.


    Wouldn't maintaining *that* data source
    become a "maintenance nightmare", too ?

    A list is a list is a list.

    A simple country/city list will need updating at some point,
    whenever a new country or a new city is added, and using
    an XML file or a table in a database as a data source only
    adds an unnecesary level of complexity to a simple dropdown,
    wouldn't you say ?

    If every time you need to populate a simple dropdown,
    you need to hit a database or an XML file, that's
    bound to perform slower than hitting an assembly which
    will be initialized the first time, but will run from memory
    from that point on.

    It's no big thing, but I like the idea of
    a dropdown initialized from an assembly.




    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Manohar Kamath" <> wrote in message
    news:%...
    >> Why would you think it's "a maintenace nightmare" ?

    >
    > Nothing against the code, but anything that is hard-coded is maintenance
    > risk -- if not in the immediate future, but soon thereafter. Plus, it is
    > adds to the inflexibility. Consider that you want to share the data with
    > another app, but you want to add new attributes like population, area,
    > etc.
    > Doing so would require not only changing the data, but also changing the
    > app, with recompile. That would also mean the clients of the app need to
    > change, or you have to create a new version to cater to the new
    > requirement.
    >
    >> Easier said than done, and you're still relying on changes
    >> which happen at some site whose html format might change,
    >> requiring a re-coding of the scrape.

    >
    > I didn't mean to use the site itself a data source, just that there was a
    > list of countries and cities, and the person could scrape that list to
    > create a data souce -- XML file, database, etc.
    >
    > --
    > Manohar Kamath
    > Editor, .netWire
    > www.dotnetwire.com
    >
    >
    > "Juan T. Llibre" <> wrote in message
    > news:...
    >> heh, heh...
    >>
    >> Hi, Manohar.
    >>
    >> re:
    >> > not sure if I would use such an app
    >> > which is a maintenance nightmare.

    >>
    >> Why would you think it's "a maintenace nightmare" ?
    >> How many countries are created every year ?
    >>
    >> re:
    >> >Our control will populate the country names at design time

    >>
    >> Yup, and then it runs as a compiled assembly, in memory.
    >>
    >> You need to change something ? Add a country/city ?
    >> Change the source, recomplie, and you're good to go.
    >>
    >> No big deal.
    >>
    >> re:
    >> > once could just scrape the countries
    >> > and cities, and create some data source.

    >>
    >> Easier said than done, and you're still relying on changes
    >> which happen at some site whose html format might change,
    >> requiring a re-coding of the scrape.
    >>
    >> I think I'd rather modify the source for the control
    >> I suggested ( complete source is included ) to add
    >> the capital cities, and then use *that*.
    >>
    >> Updates could, still, be made by checking that list
    >> you suggest, but relying on a control made by yourself
    >> is bound to provide better results than relying on a page
    >> scrape which might change at an inconvenient time,
    >> or which might be unavailable for whatever reason.
    >>
    >>
    >>
    >> Juan T. Llibre
    >> ASP.NET MVP
    >> http://asp.net.do/foros/
    >> Foros de ASP.NET en Español
    >> Ven, y hablemos de ASP.NET...
    >> ======================
    >>
    >> "Manohar Kamath" <> wrote in message
    >> news:...
    >> > Just looking at the article "Our control will populate the country
    >> > names
    >> > at
    >> > design time" -- not sure if I would use such an app which is a

    > maintenance
    >> > nightmare. From the article I suggsted, once could just scrape the
    >> > countries
    >> > and cities, and create some data source.
    >> >
    >> > --
    >> > Manohar Kamath
    >> > Editor, .netWire
    >> > www.dotnetwire.com

    >>
    >>
    >> > "Juan T. Llibre" <> wrote in message
    >> > news:...
    >> >> Why reinvent the wheel ?
    >> >>
    >> >> Use this free component :
    >> >>
    >> >> http://www.codeproject.com/aspnet/CountryCombo.asp
    >> >>
    >> >> This one only has countries, but you can easily add cities.
    >> >>
    >> >> You'll need to register with the Code Project
    >> >> in order to download the source code, but it's free.
    >> >>
    >> >> Juan T. Llibre
    >> >> ASP.NET MVP
    >> >> http://asp.net.do/foros/
    >> >> Foros de ASP.NET en Español
    >> >> Ven, y hablemos de ASP.NET...
    >> >> ======================

    >>
    >> >> "Manohar Kamath" <> wrote in message
    >> >> news:...
    >> >> > Since this list does not get deprecated that soon, why not
    >> >> > create your own web service/component? You can find a list at:
    >> >> >
    >> >

    > http://www.answers.com/topic/list-of-capitals-and-larger-cities-by-country
    >> >> >
    >> >> > --
    >> >> > Manohar Kamath
    >> >> > Editor, .netWire
    >> >> > www.dotnetwire.com
    >> >>
    >> >>
    >> >> > "David Freeman" <> wrote in message
    >> >> > news:%23juUE%...
    >> >> >> Hi There!
    >> >> >>
    >> >> >> I'm trying to create a User Registration page in ASP.NET and

    > wondering
    >> >> > what
    >> >> >> is the best way to get the list of up-to-date Countries and Cities?
    >> >> >> Are
    >> >> >> there any Web Services on the web that I can use to retrieve such
    >> >> >> information? If not, what are the options?
    >> >> >>
    >> >> >> Please, any suggestions and pointers will be very much appreciated!
    >> >> >>
    >> >> >> Dave
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >
     
    Juan T. Llibre, Mar 25, 2005
    #8
  9. David Freeman

    himasasi

    Joined:
    Apr 16, 2009
    Messages:
    1
    Hi There!

    I'm trying to create a User Registration page in FLEX and JSP and wondering what
    is the best way to get the list of up-to-date Countries and Cities? Are
    there any Web Services on the web that I can use to retrieve such
    information? If not, what are the options?

    Please, any suggestions and pointers will be very much appreciated!

    Hima
     
    himasasi, Apr 16, 2009
    #9
  10. David Freeman

    paul_cool_fl

    Joined:
    Feb 27, 2009
    Messages:
    3
    I suggest you purchase a cities database from maxmind.com or salpure.com and use ASP.Net AJAX to your work done.
     
    paul_cool_fl, Jun 9, 2009
    #10
  11. David Freeman

    siamsites

    Joined:
    Jun 12, 2009
    Messages:
    1
    Location:
    Thailand
    maxmind.com has released a complete database of world cities with world countries reference (2 letter country codes) from 2006 and 2007 for free under the GPL license, there are over 3,047,000 records in the database.

    You can download it for free at:

    www[dot]maxmind[dot]com/download/worldcities/ :beer:

    p.s. me hates the 50 post minimum to post links :damnmate:
     
    Last edited: Jun 12, 2009
    siamsites, Jun 12, 2009
    #11
  12. David Freeman

    hk123

    Joined:
    Jul 15, 2009
    Messages:
    1
    Another viable paid option is GeoDataSource.com and it comes with sample codes for ASP, .NET and PHP.
     
    hk123, Jul 15, 2009
    #12
  13. David Freeman

    cbielich

    Joined:
    May 22, 2011
    Messages:
    1
    I use countrycitystatelist.com, and its free and updated all the time :)
     
    cbielich, May 22, 2011
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Onur Bozkurt

    countries and related cities database...?

    Onur Bozkurt, Jul 23, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    709
    paul_cool_fl
    Feb 27, 2009
  2. =?Utf-8?B?Ymhhdmlr?=

    database in .Net which lists all countries, cities,

    =?Utf-8?B?Ymhhdmlr?=, Feb 4, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    356
    =?Utf-8?B?Ymhhdmlr?=
    Feb 4, 2005
  3. =?Utf-8?B?Ymhhdmlr?=

    database in .Net which lists all countries, cities

    =?Utf-8?B?Ymhhdmlr?=, Feb 5, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    850
    paul_cool_fl
    Feb 28, 2009
  4. Brendon Bezuidenhout

    ComboBox and Countries/Areas/Cities

    Brendon Bezuidenhout, Nov 16, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    772
    Brendon Bezuidenhout
    Nov 16, 2006
  5. David Freeman

    Ways to get the List of Countries and Cities

    David Freeman, Mar 25, 2005, in forum: ASP .Net Web Services
    Replies:
    7
    Views:
    177
    Juan T. Llibre
    Mar 25, 2005
Loading...

Share This Page