There are probably other issue that relate to this but I didn't see anything that reports this exactly.

I'll say this is a release 6.x-3.1 release blocker.
It's an easy fix though.

The database files for au & be have lat/lon in the incorrect order.
This means distance/proximity calculations on postcode will not work using this data.
All the files should probably be written like the de file, specifying the columns in the insert statement for clarity, and so they don't break with updated to the zipcodes table.

Comments

rooby’s picture

Title: postcode database files have lat/lon reversed. » postcode database files for au & be have lat/lon reversed.
yesct’s picture

Component: Miscellaneous » Data update
rooby’s picture

Status: Active » Needs review
StatusFileSize
new964.74 KB
new676.82 KB

Here 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.

hutch’s picture

Status: Needs review » Active
StatusFileSize
new610.1 KB

Attached is the au mysql inserts with lat/lon reversed
I tried to run the same script against be but ran into characterset problems.

rooby’s picture

StatusFileSize
new52.01 KB

Here 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.

rooby’s picture

Status: Active » Needs review
StatusFileSize
new3.68 KB
new904.01 KB
new634.87 KB

Here 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:

INSERT INTO zipcodes (zip, city, state, longitude, latitude, timezone, dst, country) VALUES ('0800', 'Darwin', 'NT', '130.842808', '-12.460698', '9', '0', 'au');

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.

hutch’s picture

The 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

rooby’s picture

Thanks 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.

hutch’s picture

Flawless 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!

rooby’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rathin2j’s picture

Version: 6.x-3.x-dev » 7.x-1.0-beta1
Category: bug » task
Priority: Critical » Normal
Status: Closed (fixed) » Needs work

Hello 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.in file .. 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..

kaizerking’s picture

here 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