Ensure ISO3166 list is up to date and ordered by country name not code

geodaniel - October 27, 2006 - 14:18
Project:location (API, module)
Version:6.x-3.x-dev
Component:Data update
Category:task
Priority:normal
Assigned:geodaniel
Status:closed
Description

There are countries in the official ISO3166-1 list that don't show up in the list of countries in the location module (Isle of Man would be one of them). We should make sure this is up to date according to the current version of the standard.

#1

geodaniel - October 27, 2006 - 14:29
Title:Ensure ISO3166 list is up to date» Ensure ISO3166 list is up to date and ordered by country name not code

Hmm, whilst doing that, perhaps we should order those countries alphabetically by name instead of by country code. That should make them appear in the right order to users, for whom the current list causes constant confusion. Think, for example, about 'Germany' between Czech Republic and Djibouti (due to its 'de' code) instead of between Georgia and Ghana where it should fit naturally.

#2

geodaniel - January 26, 2007 - 14:59
Version:4.7.x-1.x-dev» 6.x-3.x-dev

#3

geodaniel - February 1, 2007 - 13:59
Assigned to:Anonymous» geodaniel
Status:active» patch (code needs review)

I've attached a patch with a new country list based on the data at http://download.geonames.org/export/dump/countryInfo.txt (CC attribution license), sorted by country name.

There are a number of new additions (Guernsey (gg), Isle of Man (im), Jersey (je), Montenegro (me), Serbia (rs)), some codes that differ from the existing setup (Sweden (sw vs. se), United Kingdom (changed to uk)) and some that just seem to be missing .inc files (Lebanon (lb), Niger (ne)). We still need to add .inc files where necessary.

AttachmentSize
location_iso3166update.patch16.72 KB

#4

Tobias Maier - February 13, 2007 - 00:35
Status:patch (code needs review)» patch (reviewed & tested by the community)

what speaks against committing this?

#5

geodaniel - February 13, 2007 - 08:42
Status:patch (reviewed & tested by the community)» patch (code needs review)

I'm not completely happy committing this as there is still an outstanding issue with the likes of Sweden. What should we do with data that had already been entered as sw. Should that be changed to se? What if people have written code based on that in their local system?

There were no comments on the original sw vs. se issue I opened a year ago, so perhaps we don't need to worry so much, but I think we should weigh up some options.

#6

ankur - February 13, 2007 - 21:18

I think the appropriate way to deal w/ this would be to have, in the same revision, an extra function in the location.install file that does an 'UPDATE {location} SET country = 'sw' WHERE country = 'se'

As for people possibly having written code dependent on the hard-coding of a country code -- Ideally, I should be making this thing maintain a changelog for that kinda thing, with a drupal set message in the _update() function describing what changed.

Also, another reason the function is a little off is that I explicity decided to go w/ the ICANN domain letters for a country instead of the ISO but never changed the name of the function. I just couldn't imagine have 'gb' in place of 'uk' for the United Kingdom just because I'm used to seeing ".uk" on the end of a UK domain... I know; it sounds silly.

-Ankur

#7

geodaniel - March 16, 2007 - 15:19

Updated version of the patch attached, with the sw -> sw database update included (update 6). I've also renamed the sw file to se, leaving a comment for now in the old one in case anyone's wondering what happened. In addition, I've created stub files for gg, im, je, me, rs, lb and ne (Geonames doesn't list any administrative regions for any of these at the moment).

If there are no issues that anybody spots, I'll go ahead and commit this.

AttachmentSize
location_iso3166update_0.patch18.93 KB

#8

geodaniel - March 26, 2007 - 15:18
Status:patch (code needs review)» patch (reviewed & tested by the community)

I've committed the changes to location.inc, location.install and location.sw.inc on HEAD, DRUPAL-4-7, DRUPAL-5.

I've also added the stub location includes to HEAD and DRUPAL-5, and am trying to figure out how to add them to DRUPAL-4-7 too (I think CVS is choking because I messed up the original commit of the files on DRUPAL-4-7 branch).

#9

stormsweeper - April 2, 2007 - 16:56

ankur: Also, another reason the function is a little off is that I explicity decided to go w/ the ICANN domain letters for a country instead of the ISO but never changed the name of the function. I just couldn't imagine have 'gb' in place of 'uk' for the United Kingdom just because I'm used to seeing ".uk" on the end of a UK domain... I know; it sounds silly.

You may want to add this to the README or somewhere else prominently. The gb code is in very common use, and this can cause a hiccup for integrating other systems that use ISO3166-1 (e.g. the "Accept-Language" HTTP header).

#10

geodaniel - August 21, 2007 - 09:07
Status:patch (reviewed & tested by the community)» patch (code needs review)

Just noticed that the ordering of the countries in location.inc seems to have reverted to the list sorted by country code instead of country name as of 1.45.2.5... is it intentional, or is it ok if I go in and fix it up again?

#11

berenddeboer - October 18, 2007 - 21:44

geodaniel, your original patch worked great. I'm guessing no one uses the location module, sorting countries by iso code is extremely confusing for ordinary users.

#12

bdragon - January 21, 2008 - 03:15
Component:Code» Data update

Changing component to Data update.

#13

brmassa - January 21, 2008 - 21:51
Status:patch (code needs review)» fixed

Daniel,

fixed on HEAD. Soon on Location 3.

regards,

massa

#14

geodaniel - January 21, 2008 - 22:09

Thanks... great to see you guys putting a breath of life into Location!

#15

bdragon - January 21, 2008 - 22:12

Yeah, I'm excited too!

A good week for geospatial in Drupal!

#16

Anonymous (not verified) - February 4, 2008 - 22:22
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.