Needs work
Project:
Location
Version:
7.x-1.0-beta1
Component:
Data update
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Jun 2010 at 13:51 UTC
Updated:
31 Dec 2012 at 02:39 UTC
Jump to comment: Most recent file
Comments
Comment #1
rooby commentedComment #2
yesct commentedComment #3
rooby commentedHere are updated versions of the database files.
I figured it would be best to just zip up the files, the patch was nearly 30mb.
2 lots due to the 1mb upload limit.
Updated all to specify the columns for the insert statement.
Comment #4
hutch commentedAttached is the au mysql inserts with lat/lon reversed
I tried to run the same script against be but ran into characterset problems.
Comment #5
rooby commentedHere is an updated version of be from #3.
The difference is that in each INSERT statement there is now a space between VALUES and the opening bracket.
Comment #6
rooby commentedHere are updated version of all files in the same style as hutch has in #4.
Also attached is the little script I made to convert the old files to the new format.
It requires the lines of the old files to be of the form:
It doesn't matter what order the cols are in though or how many cols there are.
It can also handle having commas in the text strings, like some cities in the be file have.
To use the script remove the '_.txt' from the file name, then put it in your drupal root and
in your browser go to www.yoursite.com/parse_location_db.php/country=[country-code]
It will read the file
[path-to-location-module]/database/zipcodes.[country-code].mysql
and output the new file at
[path-to-location-module]/database/new_zipcodes.[country-code].mysql
The [path-to-location-module]/database directory must be writeable.
It should run in a couple of seconds for each file.
It will tell you if it was successful or if it failed and why.
Because of the required formatting it will work for the be file in #5 and all other files in #3.
The script can be easily modified for different formatting if needed.
Note: The script does assume that the last line of the file is the last insert statement.
It won't work properly if there are more line of text after that. It could be changed to work but it doesn't really need to.
Comment #7
hutch commentedThe sql in #6 for ch, de, no and us need the final comma replacing with ';'
I fixed that and loaded them in to a new table:
au OK and complete
be OK and complete
ch OK but has quite a few zero lat/long
de OK and complete
in has no lats and longs at all
no OK and complete but has 'NO' for all states
uk OK but no city, state
us reversed ;-(
So us needs fixing
Comment #8
rooby commentedThanks for testing those.
Damn script was supposed to get those last semicolons. Oh well, it's only a quickie one off script.
Here are updated files.
Fixed are end semicolons and the reversed us lon/lats.
I noticed those other ones before, missing data in india and uk, and now I've just noticed another issue already relating to this.
#175193: Zip code database out of date
Oh well, I'll leave this one as is and look at the other issues over at the other issue.
Comment #9
hutch commentedFlawless import!
Thanks rooby
Now to improve the data.
Another thread is #765564: Full UK zipcodes mysql file using Google, if anyone has data that maps UK postcodes to Placenames and Counties I will do what I can to get them into mysql.
And while on the subject of UK, see #832864: Invalid iso codes for countries. UK should be GB
More countries needed!
Comment #10
rooby commentedCommitted to all. Thanks for the testing.
http://drupal.org/cvs?commit=383930
http://drupal.org/cvs?commit=383928
http://drupal.org/cvs?commit=383922
Comment #12
rathin2j commentedHello sir,
i am designing a site for india which is using location module,currently the india file dump is having 0000 lat/lon values,i am having(still compiling) data but now I DONT KNOW, how to create this
zipcodes.infile .. can u guide me or give me any scrip to convert that data into this mysql dump?? i have those data in xls files.. thanks ..hoping for a positive reply..Comment #13
kaizerking commentedhere is the link to download geonames
there are two files for UK GB_full.csv.zip and GB.zip GB_full.csv.zip is huge and takes lot of space,
may be you could do that for all the countries. for UK please use GB.zip