Closed (fixed)
Project:
Location
Version:
6.x-3.1-rc1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 Nov 2009 at 16:38 UTC
Updated:
22 May 2011 at 17:11 UTC
I have searched the existing issues and have not seen this - - at least not exactly.
I need to present a list of cities and zip code (or postal codes, depending on the country) when a user selects country and state / province. I suppose this is related to reverse geocoding but not exactly.
I have UI components in place as follows: 1) user selects country from drop-down 2) user is presented with a drop-down of states/ provinces (see drupal.org/node/364287). I now need to generate a list of cities - - upon selection of a city, then a list of zip codes.
I would hugely appreciate tips / guidance.
n
Comments
Comment #1
rooby commentedFor reverse geocoding you need to have the lon/lat coordinates and then you get an address from there. That is no good for you because you don't have the coordinates, if you did then reverse geocoding could fill out all your fields automatically.
To get a list of cities you would have to have a database of all cities and their provinces somewhere.
This already exists for a few countries and you can find the database files in the location module directory under the database directory, so you can look in there and see what information is available.
To use these databases you must load the file(s) into your drupal database. Instructions for doing this are in the location module in the INSTALL.txt file (item 6 under the Installation heading).
Then you can use those database tables to generate your list of cities for a given state/province.
Note also that the uk file is incomplete and has no city data.
I also can't guarantee that these files are 100% accurate but they are probably your best bet.
If you need more information/support in regards to this just reopen this issue.
Comment #3
cbielich commentedI use countrycitystatelist.com, and its free and updated all the time :)