Within the Map Links and Geocoding Options of the Location configuration, the UK(United Kingdom) is not appearing as a country. I don't believe it to be from the countries list from geocoding/geocode.inc (http://spreadsheets.google.com/feeds/list/p9pdwsai2hDMsLkXsoM05KQ/defaul...), however, I can't be sure.

CommentFileSizeAuthor
#22 location-uk2gb-1083128-22.patch305.3 KBhutch
#18 location.1083128.patch305.3 KBjamsilver
#15 uk2gb-1083128-15.patch16.38 KBAnonymous (not verified)
#14 uk2gb-1083128-14.patch16.38 KBAnonymous (not verified)
#10 location_uk_inc_to_location_gb_inc_patch_1068724_8.patch16.1 KBAnonymous (not verified)
#7 location.gb_._inc.txt11.4 KBsimg
#5 location.gb_.inc_.txt7.48 KBidimmu

Comments

finmccarthy’s picture

Will

I think this is the same issue I had, if so the resolution is to rename the file located at

"sites/all/modules/location/supported/location.uk.inc"

to

"sites/all/modules/location/supported/location.gb.inc"

Turns out that the iso code for the UK is GB. I had to clear cache / reload pages etc afterwards

Finbarr

willhallonline’s picture

It appears that this goes half way and then you have to rename all of the functions to 'gb' from 'uk' inside the newly created location.gb.inc file to get map links to work. I am sure I have seen something like this before, not sure where though.

Not sure how to commit changes to files as it appears this will keep happening until it does?

Thanks

jeremypinto’s picture

Hi,

I have the same problem and tried to rename the file and functions, but it doesn't work. Did I miss something?

idimmu’s picture

After you've done this, don't forget to go to :

You are here
Home » Administration » Configuration » Content authoring » Location

Go to Location Utilities then 'Clear Supported Country List'

After that go to 'Geocoding Options' and enable 'United Kingdom'

bamo!

idimmu’s picture

StatusFileSize
new7.48 KB

attached my working location.gb.inc file, please rename the attachment to location.gb.inc as drupal has renamed it for security

finmccarthy’s picture

Thanks idimmu & willhallonline

I have used the file above and it works a treat.

Finbarr

simg’s picture

StatusFileSize
new11.4 KB

I found that whilst the attached location.gb.inc allowed me to enable to UK geocoding, it didn't then actually do the geocoding :/

I then found this post http://drupal.org/node/1051728 which refers to a patch to location.uk.inc which I think has somehow crossed with the above. So, I've applied the patch (had to be done by hand) to location.uk.inc and then changed the function names to _gb as above.

So, patched and "gb'd" code is attached. Exact geocoding now seems to be working for me in the UK :)

rooby’s picture

Also see #832864: Invalid iso codes for countries. UK should be GB, which is an issue for fixing the uk/gb issue for all versions.

rooby’s picture

Title: UK Map Links and Geocoding not appearing » Change country code for UK to GB

Marked #832864: Invalid iso codes for countries. UK should be GB as duplicate because you have already done work on this here.

In addition to the modified location.gb.inc we need to do database updates for the location table and the zipcodes tables.

UPDATE {zipcodes} SET country = 'gb' WHERE country = 'uk'
UPDATE {location} SET country = 'gb' WHERE country = 'uk'

The zipcodes.uk.mysql file also needs updating.

Anonymous’s picture

Just dropping my patch in here which I posted first elsewhere but have just been alerted to this issue... thought it might be of help

http://drupal.org/node/1068724#comment-4270770

pjcdawkins’s picture

Subscribing

pjcdawkins’s picture

@stevepurkiss #10

After attempting to apply that, it turns out the file location.uk.inc remained (alongside a location.uk.rej). On deleting location.uk.inc and clearing the Location caches, it started working (United Kingdom was then available as a choice).

sammyd56’s picture

subscribe

Anonymous’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev
Status: Active » Needs review
StatusFileSize
new16.38 KB

Re-rolled following the Git instructions and against 7.x-4.x-dev as that's now out should work ok.

Anonymous’s picture

Version: 7.x-4.x-dev » 7.x-3.x-dev
StatusFileSize
new16.38 KB

My bad - seems I should've rolled it against 7.x-3.x branch. Revised patch attached for review.

malcomio’s picture

the patch in #15 works for me

hutch’s picture

the patch in #15 works for me, on the current 7.x-3.x-dev
Updating zipcodes and location table as per #9 finished the job off, all is working again for gb/uk
I would regard this patch as RTBC

jamsilver’s picture

StatusFileSize
new305.3 KB

The patch also needs to change the database/zipcodes.uk.mysql to database/zipcodes.gb.mysql, replacing all occurances of 'uk' with 'gb'.

With this patch - when installing the module from scratch, there is no need to run the mysql update commands in #9. If updating an existing location installation, then those commands will still need to be run.

deeve’s picture

..without wishing to appear too dim, if I'm using cygwin to apply patch #15 & I've already cd'd to my 'location' files folder, should the cygwin command line to execute then be:
c:\cygwin\bin\patch.exe -p0 < e:\Drupal-7.0\sites\all\modules\dev\location\uk2gb-1083128-15.patch

only asking as nothing seems to be happening?

hutch’s picture

I have no experience of cygwin but it is well spoken of so it should work.
It is a git patch so use -p1
If the patch is in the current folder then you probably do not need the full path.
c:\cygwin\bin\patch.exe -p1 < uk2gb-1083128-15.patch

ankur’s picture

Status: Needs review » Needs work

I'd like to commit the patch given in #18, but it doesn't apply cleanly. It also needs to add a schema update function to location.install.

Anyone want to roll a git patch with it and post back?

hutch’s picture

StatusFileSize
new305.3 KB

Here is a freshly rolled patch, tested on a new git clone of location-7.x-3.x. It does not include any changes to location.install as it is not clear to me what those changes might be.

apply with
patch -p1 < location-uk2gb-1083128-22.patch

ecoluke’s picture

Patch #22 works for me - although I tore my hair out for a while until I noticed post #4! Ooops.

Luttappi’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev
Issue tags: +proximity search, +UK Location

Hi,

After applying patch from post 22, I can now get the State/Provice drop down populated with values and removed an error from the proximity search form. But, I can't get the proximity search working. Other than applying the patch, I have updated the country column in zipcodes table with 'gb'. Is there anything I am missing? The location version I am using is 7.x-4.x-dev. I can see the database table still don't have values for "city" and "state" columns? Is system expecting values for these?

I am relatively new to Drupal. Any help would be appreciated.

Thanks,

ankur’s picture

@Luttappi in #24:

While this is a bug that needs to be fixed in both 7.x-3.x and 7.x-4.x, you should not be using 7.x-4.x but should be using 7.x-3.x. It's not ready for production and I wouldn't even really say it's ready for testing. Please see the module home page for details: http://drupal.org/project/location

sammyd56’s picture

What is stopping this being commited?

ewills’s picture

I can confirm this works on 7.x-3.x-dev

Luttappi’s picture

The reason I used 7.x-4.x was, I saw a post somewhere saying 7.x-3.x won't work with 7.8, unless I use a patch. Since I don't have SSH/Telnet access to my server (It is a shared server), I don't know whether I can apply the patch, unless someone can shed some light on it (Please note, I just started with Drupal last week). But, I will download 3.x and see whether it makes any difference.

But, as I said, I am almost there. The Map seems working, but I can't get the distance from post code in the result set. Here is the example http://www.halalfinder.co.uk/locator (May use post code E1 7JF for testing)

Many Thanks,

ankur’s picture

@Luttappi iun #28
If you can find where it says that location needs to be patched to work with 7.8, please post a link to that place here and I'll take a look when I get a chance.

@sammyd56 in #26
We still need to add an update function that changes the country code in the zipcodes table, the location table, and any settings in the variable table where 'uk' is also being used. If anyone else can think of any other place in the database where we would need to change 'uk' to 'gb', please add it to this list:

zipcodes table
location table
variable values

hutch’s picture

Something like this:

function location_update_7301() {

  db_update('location')
    ->fields(array(
      'country' => 'gb',
    ))
    ->condition('country', 'uk')
    ->execute();

  db_update('zipcodes')
    ->fields(array(
      'country' => 'gb',
    ))
    ->condition('country', 'uk')
    ->execute();

  $uk = variable_get('location_geocode_uk', '');
  $gb = variable_get('location_geocode_gb', '');
  if ($uk) {
    variable_set('location_geocode_gb', $uk);
  }
  $uk = variable_get('location_map_link_uk', '');
  $gb = variable_get('location_map_link_gb', '');
  if ($uk) {
    variable_set('location_map_link_gb', $uk);
  }
  return;
}
ankur’s picture

Status: Needs work » Closed (fixed)

I took hutch's patch from #22, added hutch's update function from #30, and added the following line to the bottom of that update function from #30:

  cache_clear_all('*', 'cache_location', TRUE);

I went ahead and committed it to the 7.x-3.x and 7.x-4.x branches.

If something was missing, we can always add another update function.

Thanks to everyone for the patch revisions.

eamontaylor’s picture

Just adding that I did everything in step #1 and #2 but nothing happened until i edited

"sites/all/modules/location/location.inc"

and changed

'uk' => t('United Kingdom'),

to

'gb' => t('United Kingdom'),

hope this helps.