Hi,
I am trying for a few days to implement the french version of this module.
There is a problem with the existing version of the database schema : in France a unique zip can serve for a few cities for eg. I extracted a sample of the reference (one of the webpage of the poste) for the zipcode 01500. That zipcode correspond to 8 cities (as you can see below).
8 résultats
Code - Commune
01500 AMBERIEU EN BUGEY
01500 AMBRONAY
01500 AMBUTRIX
01500 BETTANT
01500 CHATEAU GAILLARD
01500 DOUVRES
01500 ST DENIS EN BUGEY
01500 ST MAURICE DE REMENS
Else than I have already compiled a file with all the zip code, lattitudes, longitudes, ... but cannot apply it before modification of the schema
Bye
Comments
Comment #1
thierry_gd commentedThat problem is probably not uniquely for France.
A good solution would be to be have a parameter for precising if the zip codes are unique (USA, ...) or not (France, ...).
With the actual configuration my data import freeze after just a few lines.
Bye
Comment #2
thierry_gd commentedAlso applicable to the cvs version
Comment #3
thierry_gd commentedTo be even more precise : in France there is 6 300 zipcode for 36 000 cities
Comment #4
thierry_gd commentedIn France cities are uniquely identified by a "code INSEE" (this code is never used by people, it is only used for statistic purpose --> insee is a governemental organisation in charge of the statistics). The zipcode can serve for a few cities which are all closed to each over.
Comment #5
ankur commentedMy recommendation would be to omit the city data for postal codes that apply to more than one city and to allow (or require) users to enter a city name when entering such a zipcode. For postal codes in your data that only apply to one city, you can still leave the city name in the table data, and the location module will use it whenever a city-name has been left out. In cases where the city name is left out in an address, but the postal code applies to more than one city, you'll have to either allow the user to leave it blank, or configure your location module settings to require the entry of a city name.
If anyone is willing to do this work, let me know. You'd have to implement a function in location.fr.inc of the signature:
function location_get_postalcode_data_fr($location = array());
See location_get_postalcode_data_us() defined in the file supported/location.us.inc for reference.
-Ankur
Comment #6
bdragon commentedThis is actually still something to consider. Assigning to data update and bumping.
Comment #7
bdragon commentedhttp://drupal.org/node/214244 marked dupe.
Comment #8
bdragon commentedRaising priority.
Comment #9
macgirvin commentedAlso applies to Australia. My 'zip' covers pretty much what we called a 'county' back in the states. My recommendation for import is to allow non-unique zip/post codes in the schema, provide tabular (multiple) results on searches and if going straight to a map, limit to the first entry if the results are ambiguous. I worked out something like this a few years back at http://macgirvin.com/zipcode - enter 2577 to see what I mean.
As it turns out, a Google map by zip code for a multi-zip region returns a map of a general area with the pointer in a non-specific area; as you would see with http://maps.google.com.au/?q=2577 - which is good enough for most uses.
Comment #10
wim leersSame problem for Belgium.
Comment #11
phildu commentedI try to use your howto :http://drupal.org/node/138006
but i have an error when i use the myql script : #1062 - Duplicate entry 'fr-01000' for key 1
any idea ?
Comment #12
demo9 commentedI've been playing around with this issue. I'm based in Australia and have create a zipcode_au.msql containing all of the relevant info: postcode data is freely available for download from Australia post. I then added the long/lat info by using the geocoder here: http://www.gpsvisualizer.com/geocoder/
I managed to get this data into the database by changing the primary key to 'state,zip,city' (instead of just 'zip'). It had to be this because some towns/postcodes exist in two states (border towns) so just using zip/city didn't work. My sql file contains 16944 records (all towns/cities & post office postal codes). The data is (as far as I know) accurate to 'post code' level..... eg. Where there are postcodes with multiple towns, the geocode data will be the same for all of them (non-specific as mention by macgirvin above.) but this is good enough for most purposes.
I can do basic searches: Node by postcode, etc but could use some help creating a proper location.au.inc (my php skills are limited). I looked at the US/CA versions but the geocoder sites used for lookups appear to be specific to those countries... Does anyone know if there is a 'geocoding' site that works for australia, using basically the same settings as the US or CA version (by changing the URL used for queries?) ...... as I said, my skils in this area are limited but I am learning...
If anyone wants/needs a copy of my geocoded database for Australia, let me know.
Comment #13
bdragon commentedI just added an update to the Drupal 5 version to stop using a primary key on zipcodes.
http://drupal.org/cvs?commit=170639
This *should* fix any remaining problems, I hope.
Comment #14
yesct commentedadding location.xx.inc so people can search for that and find this issue no matter their particular country. Also, marking fixed. If it is not fixed, please just reply back.
this #175193: Zip code database out of date might be related.