This duplicates fields as there are essentially 2 city fields, the state/province should be expanded to include "counties" for UK, e.g. West Yorkshire, Cambridgeshire, Avon, Oxfordshire, Surrey, etc.

Luke.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bdragon’s picture

Status: Active » Postponed (maintainer needs more info)

Not sure I follow. Could you explain this one further?

Lucretia9’s picture

In the state/province field you can select UK cities, such as Leeds, Peterborough, etc. These shouldn't be in this field. These cities would normally go into the "city" field and as it stands the form will contain 2 city fields.

In the state/province field, you should put the Counties as that is the closest UK equivalent. This is also what other (US) sites do. Thus, Leeds is in "West Yorkshire" and Peterborough is in "Cambridgeshire"

Luke.

uksigma’s picture

The list of 'provinces' for England (known as counties) should be as per the list found here http://en.wikipedia.org/wiki/Shire_county

Bedfordshire, Berkshire, Buckinghamshire, Cambridgeshire, Cheshire, Cornwall, Cumbria, Derbyshire, Devon, Dorset, Durham, East Sussex, Essex, Gloucestershire, Hampshire, Hertfordshire, Kent, Lancashire, Leicestershire, Lincolnshire, Norfolk, North Yorkshire, Northamptonshire, Northumberland, Nottinghamshire, Oxfordshire, Shropshire, Somerset, Staffordshire, Suffolk, Surrey, Warwickshire, West Sussex, Wiltshire, Worcestershire

and these http://en.wikipedia.org/wiki/Metropolitan_county

Greater Manchester, Merseyside, South Yorkshire, Tyne and Wear, West Midlands, West Yorkshire

Wales, Scotland and Northern Ireland will also need to be included, but I'm not sure what the relevant county names are in each

Lucretia9’s picture

Scotland and Wales have their own counties, so they should really be listed either under UK or under their own respective countries, depending on how you handle it.

But the ones you listed from the Metrolpolitan Counties also need to be listed as counties, they're not special AFAIK, they do exist, they're not pseudo counties or anything like that.

Thanks,
Luke.

La M’s picture

A UK county is the equivalent of Canadian province or US state.
In Scotland the situation is two-tier (or at least it used to be when I lived there): you have both a county (which they call a district) and a region that it is in.

In UK addresses, we generally have:
Address1: company name, building/house name, number, street
Address2: maybe a village
Town/City
County/District
Post code
Country, UK

A village is usually in or NEAR a town, a town is in or near a city and all of them are IN the county. Every UK address will have a county and a post code.

Rural addresses tend to be longer than urban ones because you would tend to have a house name and a village as extra information. And sometimes you would write the town as "Near such and such".

For example, a rural address might be something like this:

House name: The Old Smithy
House number and street: 14 Brook Street
Village/Town: Lower Piddlesthwick
Nearest Town/City: Near Malmesbury
County: Wiltshire
Post Code: MB1 2AB

or an urban address:

Number and street: Flat 15a Sea Way
Town/City: Brighton
County: West Sussex
Post code: SE2 3AB

or a business address in Scotland:

Company name: Barclays Bank Plc
Building name: Dukes House
Number and street: 1 Churchill Place
Town/City: Aberdeen
County: Kindcardineshire
Region: Grampian Region
Post Code: S14 5HP

London is a special case, in most cases people don't bother with London's county, and for the prominant areas, won't both with most of the post-code either:

Most people would write:
Kings College
Strand
London
W2

Whereas the full address is:
King's College London
Strand
London
WC2R 2LS

ctalley5’s picture

This has been throwing me off as well... that was a very helpful explanation. I see how that can cause confusion in any location/address module.

YesCT’s picture

related: #175193: Zip code database out of date (many UK issues linked there)

Lucretia9’s picture

Actually, at work (where I put on addresses for people), sometimes there is no street.

Luke.

La M’s picture

Version: 6.x-3.x-dev » 6.x-3.0-rc2
Status: Needs review » Postponed (maintainer needs more info)

Could somebody point me in the right direction for which Drupal file lists the UK counties please? Buskinghamshire is missing. Thanks

nickbits’s picture

Hi,

I have been pulling my hair out with this one. I set a site up for someone (in the UK) using this module. They had been complaining that when they entered a "State/Province" it worked fine until they went to edit the node again where the field would be empty. I have been through caches, settings, etc. It's not until I found this post I realise that the module has a BUG in it.

That is, as already noted the "state/province" links to the town/city and not the county. This is outlined above. I cannot seem to find any information on a fix for this. Is there a fix? If there is, where is it? If not, will there be a fix?

Nick

nickbits’s picture

Hi,

Forgot to ask, what other information do you need to be able to go from "postponed" to "active"?

Nick

TechnoBuddhist’s picture

Hi,

I seem to be joining the party quite late here, but I wasn't happy that there were a list of cities in the uk province list(not the maintainers fault, there are too many countries for get all correct and counties are in a mess anyway) and started to do some digging.

Firstly the county system here in the uk is in a bit of a state. Traditional counties, day to day counties, admin counties and royal mail don't make it easier when they drop county support.

Given the mess, I looked at the office of national statistics and a few other places, none agreed with a complete list. So in the end I decided to try something that has probably been tested on a day to day basis year in year out by users... I looked at the county list provided by OSCommerce. There have been a couple of patches(de-duping, etc...) and its just the first one I tried, other carts will have their own and maybe a merge of all would be even better. This is as a starter for 10 and includes England, Scotland, Wales and Northern Ireland.

in location/supported/location.uk.inc I changed the function location_province_list_uk() to

function location_province_list_uk() {
  return array(
		'ABD' => 'Aberdeenshire',
		'ALD' => 'Alderney',
		'ANS' => 'Angus',
		'ARB' => 'Argyll and Bute',
		'ANT' => 'County Antrim',
		'ARM' => 'County Armagh',
		'AYR' => 'Ayrshire',
		'BAN' => 'Banffshire',
		'BEW' => 'Berwickshire',
		'BSTL' => 'Bristol',
		'BEDS' => 'Bedfordshire',
		'BERK' => 'Berkshire',
		'WMID' => 'West Midlands',
		'BLGW' => 'Blaenau Gwent',
		'BORD' => 'Borders',
		'BRID' => 'Bridgend',
		'BUCK' => 'Buckinghamshire',
		'CAER' => 'Caerphilly',
		'CAIT' => 'Caithness',
		'CAMB' => 'Cambridgeshire',
		'CARD' => 'Cardiff',
		'CARM' => 'Carmarthenshire',
		'CENT' => 'Central',
		'CERE' => 'Ceredigion',
		'CHES' => 'Cheshire',
		'CHI' => 'Channel Islands',
		'CLK' => 'Clackmannanshire',
		'CLWY' => 'Clwyd',
		'CONW' => 'Conway',
		'CORN' => 'Cornwall',
		'CUMB' => 'Cumbria',
		'DENB' => 'Denbighshire',
		'DERB' => 'Derbyshire',
		'DEVO' => 'Devon',
		'DORS' => 'Dorset',
		'DOW' => 'County Down',
		'DGY' => 'Dumfries & Galloway',
		'DNB' => 'Dunbartonshire',
		'DURH' => 'County Durham',
		'DYFE' => 'Dyfed',
		'ESSE' => 'Essex',
		'ELN' => 'East Lothian',
		'ESUS' => 'East Sussex',
		'FER' => 'Fermanagh',
		'FIF' => 'Fife',
		'FLIN' => 'Flintshire',
		'GLAM' => 'Glamorgan',
		'GLOU' => 'Gloucestershire',
		'GRAM' => 'Grampian',
		'GSY' => 'Guernsey',
		'GWEN' => 'Gwent',
		'GWYN' => 'Gwynedd',
		'HAMP' => 'Hampshire',
		'HERE' => 'Herefordshire',
		'HERT' => 'Hertfordshire',
		'EYOR' => 'East Riding of Yorkshire',
		'INV' => 'Inverness-shire',
		'IOAN' => 'Isle of Anglesey',
		'IOMN' => 'Isle of Man',
		'IOWT' => 'Isle of Wight',
		'JSY' => 'Jersey',
		'KENT' => 'Kent',
		'KCD' => 'Kincardineshire',
		'KKD' => 'Kirkcudbrightshire',
		'KRS' => 'Kinross-shire',
		'LKS' => 'Lanarkshire',
		'LANC' => 'Lancashire',
		'LDY' => 'Londonderry',
		'LEIC' => 'Leicestershire',
		'LINC' => 'Lincolnshire',
		'LOND' => 'London',
		'MLN' => 'Midlothian',
		'MANC' => 'Manchester',
		'MERS' => 'Merseyside',
		'MDSX' => 'Middlesex',
		'MERT' => 'Merthyr Tydfil',
		'MONM' => 'Monmouthshire',
		'MOR' => 'Moray',
		'NAI' => 'Nairnshire',
		'NEAT' => 'Neath Port Talbot',
		'NEWP' => 'Newport',
		'NHAM' => 'Northamptonshire',
		'NORF' => 'Norfolk',
		'NOTT' => 'Nottinghamshire',
		'NUMB' => 'Northumberland',
		'NWHI' => 'North West Highlands',
		'NYOR' => 'North Yorkshire',
		'OKI' => 'Orkney',
		'OXFO' => 'Oxfordshire',
		'PEE' => 'Peeblesshire',
		'PER' => 'Perthshire',
		'PEMB' => 'Pembrokeshire',
		'POWY' => 'Powys',
		'RFW' => 'Renfrewshire',
		'ROC' => 'Ross and Cromarty',
		'ROX' => 'Roxburghshire',
		'SEL' => 'Selkirkshire',
		'SHI' => 'Shetland',
		'SHRO' => 'Shropshire',
		'SOME' => 'Somerset',
		'STAF' => 'Staffordshire',
		'STI' => 'Stirlingshire',
		'STD' => 'Strathclyde',
		'SUFF' => 'Suffolk',
		'SURR' => 'Surrey',
		'SUT' => 'Sutherland',
		'SWAN' => 'Swansea',
		'SYOR' => 'South Yorkshire',
		'SAYR' => 'South Ayrshire',
		'TAFF' => 'Rhondda Cynon Taff',
		'TAY' => 'Tayside',
		'TORF' => 'Torfaen',
		'TYR' => 'County Tyrone',
		'TYWE' => 'Tyne & Wear',
		'VALE' => 'Vale of Glamorgan',
		'WORC' => 'Worcestershire',
		'WARW' => 'Warwickshire',
		'WIG' => 'Wigtownshire',
		'WILT' => 'Wiltshire',
		'WIS' => 'Western Isles',
		'WLN' => 'West Lothian',
		'WREX' => 'Wrexham',
		'WSUS' => 'West Sussex',
		'WYOR' => 'West Yorkshire'
		);
}

after that I went to admin/settings/location/util and cleared the province cache.

"Leeds the city is now in West Yorkshire" not "Leeds the city is now in province Leeds".

It doesn't seem to matter that some of these are 4 char codes instead of 3, maybe a location dev could confirm this is good to go?

Does this help?

Oh, I also use String Overrides module to change the "State / Province" prompt to "County"

EDIT: Updated with Scottish counties.

TechnoBuddhist’s picture

WARNING!!

*IF* you use the above changes above in [#12] then you will need to change all the 'province' fields in your 'location' table. For me that means my users and my Organic Groups.

e.g. I had users with 'GLS', they needed to be changed to 'GLOU'.

New users and groups aren't affected and are fine with the new provinces.

If you wanted to avoid this then you could change the province abbreviations to something more aligned with your data.

eff_shaped’s picture

I'm looking into inserting UK counties to the location module (instead of the US states).

Can anyone explain what the point is of the abbreviations? How does drupal use them?
The ones in the list in comment #12 don't relate to abbreviations we actually use in the UK for counties.

Can I put the function location_province_list_uk() into my theme template and have it overide the location module include?
I would prefer not to go down the route of hacking a module, and keeping track of those hacks.

eff_shaped’s picture

I really wish there was some clear documentation on how to do this. As a non-programmer type, I need to know how these files all relate and where to put the code.

I've tried to do what I know - and it doesn't work for me. Help appreciated.

The information on this is all over the site and dates back for years. What is the current situation with Location module and how to fix this? For example, it's hard to tell whether things have been included in upgrades after any particular thread.

TechnoBuddhist’s picture

Update to #12 above.

After some more dev work, leading me right back to this thread and reading #14 and #15 I did some more digging around.

1. I don't know the point of abbreviations, I've not found out.
2. The county codes I used in #12 were not fully thought out and were a mix of 3/4 chars ISO-3166-1:GB, Chapman Codes and others. The county codes below are ALL 3 character codes from ISO-3166-1:GB and Chapman.
3. "Can I put the function location_province_list_uk() into my theme template and have it overide the location module include?
I would prefer not to go down the route of hacking a module, and keeping track of those hacks." - You won't be able to drop it in as "location_province_list_uk()" because all theme functions must begin with your theme name. I don't think it would work if you tried... but all you have to do is try it!! Something like "mytheme_province_list_uk()" should do, don't forget to use the location utilities to clear the caches.
4. If you're a non-programmer type, you shouldn't be tinkering with code. You need at least some coding knowledge before you attempt any patches or hacks. 1 missing character or 1 wrong character in the wrong place and your whole site could stop in an instant.
5. I agree there are hacks all over the place, but the developer is undoubtedly a busy person and doesn't have the time to add all the hacks into the module. It's their module and they may not agree with some of the hacks and never put them in. This is the community in action. I've got a fairly hefty site and I absolutely have to keep track of code mods I make, because the way I want things isn't exactly the way others do. When there's a new release, I check my document to see if I've got mods in that module and what file and function, then I do a 'diff' and re-apply my mods. The 'release notes' should tell you what mods have been applied. I'm afraid you need to learn some coding, it's a wonderful world when you 'get it'!

So onto an update for those that it may prove useful to. I've changed the codes back to 3 character codes, changed the description of some of the counties(e.g. Greater Manchester -> Manchester (Greater)) but the counties have remained as is. The ISO-3166-2:GB codes contain council areas which is not what we want, we want counties only. You'd think all the things that ISO have codes for they'd have one for counties AND one for councils, but alas no!

This code is in supported/location.uk.inc

function location_province_list_uk() {
  return array(
    'ABD' => 'Aberdeenshire',
    'ALD' => 'Alderney',
    'AGY' => 'Anglesey (Isle of)',
    'ANS' => 'Angus',
    'AGB' => 'Argyll and Bute',
    'AYR' => 'Ayrshire',
    'BAN' => 'Banffshire',
    'BDF' => 'Bedfordshire',
    'BRK' => 'Berkshire',
    'BEW' => 'Berwickshire',
    'BGW' => 'Blaenau Gwent',
    'BOR' => 'Borders',
    'BGE' => 'Bridgend',
    'BST' => 'Bristol',
    'BKM' => 'Buckinghamshire',
    'CAY' => 'Caerphilly',
    'CAI' => 'Caithness',
    'CAM' => 'Cambridgeshire',
    'CRF' => 'Cardiff',
    'CMN' => 'Carmarthenshire',
    'CEN' => 'Central Scotland',
    'CGN' => 'Ceredigion',
    'CHI' => 'Channel Islands',
    'CHS' => 'Cheshire',
    'CLK' => 'Clackmannanshire',
    'CWD' => 'Clwyd',
    'CWY' => 'Conwy',
    'CON' => 'Cornwall',
    'ANT' => 'County Antrim',
    'ARM' => 'County Armagh',
    'DOW' => 'County Down',
    'DUR' => 'County Durham',
    'TYR' => 'County Tyrone',
    'CMA' => 'Cumbria',
    'DEN' => 'Denbighshire',
    'DER' => 'Derbyshire',
    'DEV' => 'Devon',
    'DOR' => 'Dorset',
    'DGY' => 'Dumfries & Galloway',
    'DNB' => 'Dunbartonshire',
    'DYD' => 'Dyfed',
    'ELN' => 'East Lothian',
    'ERY' => 'East Riding of Yorkshire',
    'ESX' => 'East Sussex',
    'ESS' => 'Essex',
    'FER' => 'Fermanagh',
    'FIF' => 'Fife',
    'FLN' => 'Flintshire',
    'GLA' => 'Glamorgan',
    'GLS' => 'Gloucestershire',
    'GMP' => 'Grampian',
    'GSY' => 'Guernsey',
    'GNT' => 'Gwent',
    'GWN' => 'Gwynedd',
    'HAM' => 'Hampshire',
    'HEF' => 'Herefordshire',
    'HRT' => 'Hertfordshire',
    'HLD' => 'Highlands',
    'INV' => 'Inverness-shire',
    'IOM' => 'Isle of Man',
    'IOW' => 'Isle of Wight',
    'JSY' => 'Jersey',
    'KEN' => 'Kent',
    'KCD' => 'Kincardineshire',
    'KRS' => 'Kinross-shire',
    'KKD' => 'Kirkcudbrightshire',
    'LKS' => 'Lanarkshire',
    'LAN' => 'Lancashire',
    'LEI' => 'Leicestershire',
    'LIN' => 'Lincolnshire',
    'LND' => 'London',
    'LDY' => 'Londonderry',
    'GTM' => 'Manchester (Greater)',
    'MSY' => 'Merseyside',
    'MTY' => 'Merthyr Tydfil',
    'MDX' => 'Middlesex',
    'MLN' => 'Midlothian',
    'MON' => 'Monmouthshire',
    'MOR' => 'Moray',
    'NAI' => 'Nairnshire',
    'NTL' => 'Neath Port Talbot',
    'NWP' => 'Newport',
    'NFK' => 'Norfolk',
    'NYK' => 'North Yorkshire',
    'NTH' => 'Northamptonshire',
    'NBL' => 'Northumberland',
    'NTT' => 'Nottinghamshire',
    'OKI' => 'Orkney',
    'OXF' => 'Oxfordshire',
    'PEE' => 'Peeblesshire',
    'PEM' => 'Pembrokeshire',
    'PER' => 'Perthshire',
    'POW' => 'Powys',
    'RFW' => 'Renfrewshire',
    'RCT' => 'Rhondda Cynon Taff',
    'ROC' => 'Ross and Cromarty',
    'ROX' => 'Roxburghshire',
    'SEL' => 'Selkirkshire',
    'SHI' => 'Shetland',
    'SHR' => 'Shropshire',
    'SOM' => 'Somerset',
    'SYK' => 'South Yorkshire',
    'STS' => 'Staffordshire',
    'STI' => 'Stirlingshire',
    'STD' => 'Strathclyde',
    'SFK' => 'Suffolk',
    'SRY' => 'Surrey',
    'SUT' => 'Sutherland',
    'SWA' => 'Swansea',
    'TAY' => 'Tayside',
    'TOF' => 'Torfaen',
    'TWR' => 'Tyne & Wear',
    'WAR' => 'Warwickshire',
    'WLN' => 'West Lothian',
    'WMD' => 'West Midlands',
    'SXW' => 'West Sussex',
    'WYK' => 'West Yorkshire',
    'WIS' => 'Western Isles',
    'WIG' => 'Wigtownshire',
    'WIL' => 'Wiltshire',
    'WOR' => 'Worcestershire',
    'WRX' => 'Wrexham',
  );
}
YesCT’s picture

Good news. Ankur is cleaning up some things, going to release a new point in the version of the module, and then commit more patches. So, there is a very good chance of getting patches in, better than in a long time. Yes the maintainers are volunteers and are really busy, sometimes falling on hard times. We have a renewed opportunity now.

To get the best odds of getting some changes in:
1) download the new dev version
http://drupal.org/project/location/
2) make a patch to that (or re-roll a previous patch to match the new dev version) [and mark the issue status to needs review]
http://drupal.org/patch/create
(coding standards when making changes to code: http://drupal.org/coding-standards)
3) have at least one other person test the patch and report back here how it went [and mark the issue status to RTBC]
how to apply a patch: http://drupal.org/patch/apply
which is part of a larger "help test code" section: http://drupal.org/node/314199

to find someone to review for you, maybe contact someone that seemed interested in the issue in the past, maybe look for them on irc. http://drupal.org/irc
I'll review patches for people when I can. I'd really like to get some of these old issues cleared up too. :)

Oh, another option is to post a bounty or look for someone in #drupal-consultants and offer to pay a fee for someone to write a new patch for you... I've done that once or twice with good results for things that would have just taken me too long to figure out myself and I was in a hurry to get a solution.

TechnoBuddhist’s picture

Version: 6.x-3.0-rc2 » 6.x-3.x-dev
Status: Postponed (maintainer needs more info) » Needs review
FileSize
10.29 KB

My changes in #16 as a patch against 6.x-3.x-dev (2010-Mar-29). Open for review and testing by the community.

TechnoBuddhist’s picture

FileSize
10.24 KB

As part of my updating of a couple of other location.xx.inc files, in particular, Jersey, Guernsey and Isle of Man I noticed that Jersey and Guernsey were listed as counties of UK, which they aren't! they are separate countries. I've removed them from this new patch.

This patch supercedes #18 above. patched to same dev release 6.x-3.x-dev (2010-Mar-29).

TechnoBuddhist’s picture

FileSize
10.25 KB

GRRR. sorry folks. I applied the above patch and I kept getting a 'malformed patch'. might have just been on my system, but here's a version that patched correctly with

patch -p0 < location.uk_.inc_.patch

sderrick’s picture

I'm so glad to hear this is being fixed!

We are just starting to input our UK addresses.

http://horseschoolsonline.com/school_map

And running into huge problems.

It won't let us input Counties into the State/Province box!
And what happened to the Countries of Wales, Scotland, North Ireland?

When a working patch is ready we are ready to test!

Scott

TechnoBuddhist’s picture

Scott,

Apply the patch in #20 and provide feedback, that's why this thread is marked as 'Needs Review'. It contains the counties for England, Scotland, Wales and NI.

Any problems, I'm glad to help.

eff_shaped’s picture

@TechnoBuddist
Thanks so much for the response and your work on this. I know times are hard and spare time valuable.

If I have to keep those abbreviated county codes, I'd really like to have them just remain invisible to all users. So that only full county/authority names are used both in the autocomplete field and in any display. The 3 character codes are not recognised by users as normal address elements.

Is there a way of changing what the location module does with that part of the array? Can we just find a way to use the list of counties/authorities we want to, without the 'county codes'?

(I have to admit I do go into The Code sometimes (I can code html and css, and add to and edit some scripts) - and when it breaks my site, I go back and undo what I did, if my mistake is not obvious to me. I did try the mytheme_province_list_uk() in my template.php -- you are right -- no joy.)

I will attempt to look into how to apply a patch, when I get the opportunity. Then I can join in and test.

TechnoBuddhist’s picture

One is glad to be of service :-)

When I'm displaying an address (only with the users permission) I use this snippet in my own module;

$loc = location_load_locations($user->uid, 'uid');

if ($loc[0]['street']) { $addr = "\n  " . $loc[0]['street']; }
if ($loc[0]['additional']) { $addr .= "\n  " . $loc[0]['additional'];}
if ($loc[0]['city']) { $addr .= "\n  " . $loc[0]['city'];}
if ($loc[0]['province_name']) { $addr .= "\n  " . $loc[0]['province_name'];}
if ($loc[0]['postal_code']) { $addr .= "\n  " . $loc[0]['postal_code'];}

The key is using 'province_name' and not 'province'. I only allow 1 location hence the use of $loc[0].

I don't override the 3 letter code when a user wants to change their address, so can't help you I'm afraid. It's not something that occurred to me to change, ppl don't change their county very often at all I guess that's why.

La M’s picture

Buckinghamshire is missing from the list of counties above.

La M’s picture

Can you give an example Luke where there is no street? I think that would probably only happen for very rural addresses where it was a farm or something and there was no street.

In general I think that all lines of UK addresses are optional except county and post code. Even county and the second part of the post code is optional in the case of London where you wouldn't need to add it (although the information would exist).

UK addresses are a bit of a nightmare really aren't they. I guess that's what comes of having evolutionary town planning. I think the only things that could be certain are the list of towns/cities and the list of counties.

La M’s picture

Version: 6.x-3.0-rc2 » 6.x-3.x-dev
Status: Postponed (maintainer needs more info) » Needs review

Re. Scotland

I see that in the list above you are including Scottish regions in with the list of counties, but they are different: Scottish counties (which they call districts) are IN Scottish regions. For example, Kincardineshire is a Scottish district and it is inside the region called Grampian region.

Or at least this is how it used to be, but a wiki article I read seemed to suggest that this two-tier system was scrapped in the 1990s and now Scotland just uses counties. (http://en.wikipedia.org/wiki/Local_government_areas_of_Scotland_1973_to_...)

I would imagine that if this is the case then the regions don't exist anymore. Either way they shouldn't be in the county list.

Regions: Strathclyde, Dumfries and Galloway, Borders, Lothian, Central, Fife, Tayside, Grampian, Highland, Western Isles, Shetland, Orkney.

La M’s picture

Bristol is a city not a county. Bristol is in the county of Avon.

andybill’s picture

just to add info to discussion, but also a digression into addressing rather than locations, here's an explanation of how postcodes are put together .... http://www.evoxfacilities.co.uk/evoxps.htm

Point is that you'll see there is a link to a list of post towns by area (e.g.

BN Arundel, Brighton, Eastbourne, Hailsham, Hassocks, Henfield, Hove, Lancing, Lewes, Littlehampton, Newhaven, Peacehaven, Pevensey, Polegate, Seaford, Shoreham-By-Sea, Steyning, Worthing

RH Betchworth, Billingshurst, Burgess Hill, Crawley, Dorking, East Grinstead, Forest Row, Gatwick, Godstone, Haywards Heath, Horley, Horsham, Lingfield, Oxted, Pulborough, Redhill, Reigate)

The principle point to add to the discussion is that postcode areas and county boundaries do not match up and county should not be taken for granted: RH includes Godstone for example, which is in Surrey, but a lot of the RH area is West Sussex in terms of county - or, to confuse yet more, Mid-Sussex in terms of district council. I did once see an official (as in govt) letter to a business as (business name), (building name), (street), (town), Mid Sussex, West Sussex, RH15 9xy
I don't think it's sensible to attempt to fit all of the possible combinations: don't the Post Office use building name/number, address line 1, address line 2 (optional), town, country (optional), postcode?

Just in terms of addressing, when you try to cover all bases you end up with stupid things like the example that hit me yesterday: three times in a row a US website rejected a completely valid UK address for card validation, until I tried the address as
Address 1: (house address)
Address 2: (town) (bigger town nearby)
City: (city that's thirty miles away with which we share nothing other than postcode)
Country: Great Britain (let's not even get into the fact that Great Britain isn't a country, it's England or UK in our case!)
Zipcode: (postcode)

Now leaving aside the fact that I'd already set country as UK at login (so why it suggested Great Britain as a country is beyond me), this seems to be a good example of how location information does not translate - and also how certain sites (let alone card processors) can't be bothered to actually follow a discernible pattern.

Does the following work as a model address for most people on here? With the * proviso it looks ok for most of Europe, Aus/NZ, SA, US/Can; to make it work elsewhere (eg) Japan you have to be flexible in using 'street 2' as a smaller town, but really need to avoid the silliness of needing "address 2" to be !!

(house number) (street name) /alternatively, a PO Box/
/optional street 2, or suburb, or route/
* (town/city) *
/optional county/province/state/prefecture/
* /optional country/
(postcode/etc)

In the case of a site needing to print/display addresses, there should be the option of displaying the "postcode" at positions marked with * depending on the country. () things would have to be mandatory and / things optional; it'd be good to exercise some sort of control on town as a list of post towns (in a UK sense), but I'm not sure that's practical ...

anyway, sorry for digression: I just don't think it's going to be possible to come up with a definitive _and_ easy to use list of cities/counties/regions; it might be one or the other.

@La M - Kincardinshire as a county authority ceased to be in 1975, isn't it part of the Aberdeenshire council area since '96? what authority do we use for deciding whether counties that no longer have an administrative nature still exist? E.g. a former colleague used to put his address as Rutland - I don't think he ever met a computer system that would let him, but he was adamant that he lived in Rutland ...

YesCT’s picture

marked #652736: UK county missing from list as a duplicate of this issue (but not sure if it is an "exact" duplicate, or if there is just overlap.

eff_shaped’s picture

Here is the list of regions I have put together (170 total). These are combined from the UK government office of national statistics.
Including:
Non-metropolitan counties (England)
Unitary Authorities (England and Wales)
Metropolitan counties (England)
Council Areas (Scotland)
District Council Areas (Norther Ireland)
Greater London (England)

Hopefully I haven't missed any.

United Kingdom: Counties and Unitary Authorities

Aberdeen City
Aberdeenshire
Angus
Antrim
Ards
Argyll & Bute
Armagh
Ballymena
Ballymoney
Banbridge
Bath and North East Somerset
Bedford
Belfast
Blackburn with Darwen
Blackpool
Blaenau Gwent
Bournemouth
Bracknell Forest
Bridgend
Brighton and Hove
Bristol, City of
Buckinghamshire
Caerphilly
Cambridgeshire
Cardiff
Carmarthenshire
Carrickfergus
Castlereagh
Central Bedfordshire
Ceredigion
Cheshire East
Cheshire West and Chester
Clackmannanshire
Coleraine
Conwy
Cookstown
Cornwall
County Durham
Craigavon
Cumbria
Darlington
Denbighshire
Derby
Derbyshire
Derry City
Devon
Dorset
Down
Dumfries & Galloway
Dundee City
Dungannon
East Ayrshire
East Dunbartonshire
East Lothian
East Renfrewshire
East Riding of Yorkshire
East Sussex
Edinburgh, City of
Eilean Siar
Essex
Falkirk
Fermanagh
Fife
Flintshire
Glasgow City
Gloucestershire
Greater London
Greater Manchester
Gwynedd
Halton
Hampshire
Hartlepool
Herefordshire, County of
Hertfordshire
Highland
Inverclyde
Isle of Anglesey
Isle of Wight
Isles of Scilly
Kent
Kingston upon Hull, City of
Lancashire
Larne
Leicester
Leicestershire
Limavady
Lincolnshire
Lisburn
Luton
Magherafelt
Medway
Merseyside
Merthyr Tydfil
Middlesbrough
Midlothian
Milton Keynes
Monmouthshire
Moray
Moyle
Neath Port Talbot
Newport
Newry and Mourne
Newtownabbey
Norfolk
North Ayrshire
North Down
North East Lincolnshire
North Lanarkshire
North Lincolnshire
North Somerset
North Yorkshire
Northamptonshire
Northumberland
Nottingham
Nottinghamshire
Omagh
Orkney Islands
Oxfordshire
Pembrokeshire
Perth & Kinross
Peterborough
Plymouth
Poole
Portsmouth
Powys
Reading
Redcar and Cleveland
Renfrewshire
Rhondda, Cynon, Taff
Rutland
Scottish Borders
Shetland Islands
Shropshire
Slough
Somerset
South Ayrshire
South Gloucestershire
South Lanarkshire
South Yorkshire
Southampton
Southend-on-Sea
Staffordshire
Stirling
Stockton-on-Tees
Stoke-on-Trent
Strabane
Suffolk
Surrey
Swansea
Swindon
Telford and Wrekin
The Vale of Glamorgan
Thurrock
Torbay
Torfaen
Tyne and Wear
Warrington
Warwickshire
West Berkshire
West Dunbartonshire
West Lothian
West Midlands
West Sussex
West Yorkshire
Wiltshire
Windsor and Maidenhead
Wokingham
Worcestershire
Wrexham
York

Government areas have changed a lot in the last decade. The county of Avon, for instance, does not exist any more. Surprising to see tiny areas, like Southend-on-Sea as separate authorities, but there you go.

Getting this list to work with Location module... a whole other matter. :)

eff_shaped’s picture

aha! looks like Rutland is back on the map (see #31). @andybill - tell your mate!

Peng.Pif’s picture

#20 works good for me.

Thanks.

md2’s picture

#31 Just a quick note.

"Tyrone" is missing -> http://en.wikipedia.org/wiki/County_Tyrone

eff_shaped’s picture

Yeah, it's odd to see things like that - I think the unitary authorities are different to old counties in places. For example the English county of Avon no longer exists in the government map.

I think Tyrone is split into Strabane, Omagh, Cookstown and Dungannon as unitary authorities.

People may look for Tyrone, but will hopefully see their more specific area and choose that.

DanielJohnston’s picture

Subscribing. I'll give the patch a bash. However, I'm doing mass import of addresses, and suspect that the Location approach to counties can't handle this. Most people write most counties in different ways. E.g. West Midlands can be shortened to WM or West Mids, and is often left out if something's in Birmingham, Manchester can be Manchester, Greater Manchester, but is stored here as Manchester (Greater). Forcing people to stick to an official list is good for manual input, but can't cope with imported data that shows these variations all over the place.

As a side note, I suspect the abbreviated storage for states come from the US practice of shortening all states to two letters, e.g. MI for Michigan, NY for New York and so on. Everyone in the US knows what the state codes mean as they're completely standardised.

DanielJohnston’s picture

OK, I've tested the patch at #20 with a mass import of offices covering the entire UK, also locations in Jersey, Guernsey and the Isle of Man. Used Node Import but will probably try with Feeds at a later point.

About three quarters of user-inputted addresses matched to the province list and imported correctly. One quarter didn't and had to be reimported with blank province fields. This is a problem with Node Import or Location's approach to provinces generally, not this patch.

Given that Location can successfully geocode to locations in Jersey, Guernsey and the Isle of Man if they're counted as part of the UK, and that the Location setting that forces country to United Kingdom only should ideally include these three dependencies if it's to be of any use, I'm going to put them back in the province list on my server. Other than that I'd suggest this gets committed. Does this count as reviewing the patch?

hutch’s picture

FileSize
10.57 KB

Attached is a patch on supported/location.uk.inc which includes Jersey, Guernsey and Isles of Scilly and is based on the patch in #20. The Isle of Man is still there. It has been made on current CVS

Although the people in those locations may regard themselves as independent, as far as geocoding goes they are part of the UK. I live in Wales and understand these annoyances very well ;-/

dunx’s picture

I can't find admin/settings/location/util to clear the province cache. This just goes to the Main Settings for Location and there's no Utilities tab or anything obvious like that. I seem to have all the Location modules enabled.

Can anybody point me in the right direction?

I think this feature may be in the latest 3-dev, not 3 which I'm using.

http://drupal.org/node/363584

In the end I just deleted the provinces:uk record from the cache_location table using phpMyAdmin.

DELETE FROM `blah`.`cache_location` WHERE `cache_location`.`cid` = 'provinces:uk' LIMIT 1

nemchenk’s picture

@dunx -- I just comment out the line in location.inc (approx. line 426) which deals with the cache:

if ($cache = cache_get("provinces:$country", 'cache_location')) {
$provinces[$country] = $cache->data;
// return $provinces[$country]; // comment this out
}

The patch from #38 failed to apply against r1.7 of location.uk.inc in CVS. I'll roll a new patch and attach it...

nemchenk’s picture

FileSize
10.54 KB

Patch against v1.7 of CVS DRUPAL-6--3

oglord’s picture

This just goes to show how pointless this field is. The real list of the 92 geographical counties (not administrative areas as most of these lists contain) is:

Aberdeenshire
Anglesey
Angus
Antrim
Argyllshire
Armagh
Ayrshire
Banffshire
Bedfordshire
Berkshire
Berwickshire
Brecknockshire
Buckinghamshire
Buteshire
Caernarfonshire
Caithness
Cambridgeshire
Cardiganshire
Carmarthenshire
Cheshire
Clackmannanshire
Cornwall
Cromartyshire
Cumberland
Denbighshire
Derbyshire
Devon
Dorset
Down
Dumfriesshire
Dunbartonshire
Durham
East Lothian
Essex
Fermanagh
Fife
Flintshire
Glamorgan
Gloucestershire
Hampshire
Herefordshire
Hertfordshire
Huntingdonshire
Inverness-shire
Kent
Kincardineshire
Kinross-shire
Kirkcudbrightshire
Lanarkshire
Lancashire
Leicestershire
Lincolnshire
Londonderry
Merionethshire
Middlesex
Midlothian
Monmouthshire
Montgomeryshire
Morayshire
Nairnshire
Norfolk
Northamptonshire
Northumberland
Nottinghamshire
Orkney
Oxfordshire
Peeblesshire
Pembrokeshire
Perthshire
Radnorshire
Renfrewshire
Ross-shire
Roxburghshire
Rutland
Selkirkshire
Shetland
Shropshire
Somerset
Staffordshire
Stirlingshire
Suffolk
Surrey
Sussex
Sutherland
Tyrone
Warwickshire
West Lothian
Westmorland
Wigtownshire
Wiltshire
Worcestershire
Yorkshire
jollyroger’s picture

Very good post by oglord #42. The list is an accurate list of the 92 counties but I would just like to make a couple of observations.

As far as I am aware, and I stand to be corrected, the six Northen Ireland counties are always referred to including the word County, i.e. County Antrim. I have seen them listed without but I think it is more normal and correct to include the County. This is also the case for County Durham as well. The reason for Durham is that it is the only GB county that has a city within the county with the same name. Otherwise you could end up with a postal address including Durham, Durham which would be strange (and also sounds like the Pink Panther theme!). Some of the NI counties also include city/town names as well - Antrim, Armagh and Londonderry.

Another point is that although the list is technically sound it doesn't cover the whole of the UK, at least not from a postal point of view. If you want to cover all postcode areas you would also have to add options for Isle of Man, Jersey, Guernsey, Alderney, etc and maybe even the Scilly Isles.

One last point relating to a comment elsewhere in the thread is that the county part of a UK address is NOT mandatory. The only elements required to get an item of post to the correct address is the house name/number plus the full postcode. I don't think the Post Office encourage that minimal information in case of misreading the details. They would always want the post town and street address but the county is not used. In fact the Post Office removed counties from their PAF (Postcode Address File) which is a master list of all UK addresses many years ago.

nemchenk’s picture

The problem with the above list, however, is that most UK residents from London will not know that it is actually in Middlesex.

This fields should help users fill in their address, not teach them about the intricacies of the UK counties!

hutch’s picture

Re #42, many of the Welsh shires disappeared in the 1970's in the Local government reorganisation of that time, see

http://en.wikipedia.org/wiki/Preserved_counties_of_Wales

These are the ones that google recognises.

Anonymous’s picture

Hutch makes a good point. Do we know which of these counties are supported by Google Maps? Surely if they aren't recognised then, when using the GMap module, the map will not render?

S

MrPaulDriver’s picture

Latest 6.x-3.x-dev release.

- location.uk.inc file is still named uk instead of gb.
Perhaps this is by design as UK is more familiar than GB, it does however install correctly.

- the county list is still incorrect and excludes Avon, Berkshire and perhaps others.

hutch’s picture

I imagine that the change to GB will happen in 7.x-4.x when the countries list will (I believe) be integrated with the builtin one.

The UK counties list is full of anomalies and I have yet to find a definitive list anywhere on the web. The UK postoffice ignores them and Google seems to work on postcodes although county names do work too including obsolete ones.

The problem is that the mechanism for dealing with county/state/province names in Location module does not have a facility for aliases and I'm not sure it would be worth the hassle of implementing one.

gorsti’s picture

Version: 6.x-3.x-dev » 6.x-3.1

Hi there, I am trying to make sense of what and how to patch / update.... I have an operational website, using location 6.x-3.1 and expereince the problem as outlined in this thread. However, I am needing to patch the location module, as I cannot correctly add location content to the site until I have an updated list for the state/province related to the UK. Do I use the patch from #38 or #41 or do I move to dev? Is there a timeline for a new release version to include these patches?

Thanks //G

imeldamayhem’s picture

Category: bug » feature

I would like to add some information on the counties issue. I understand that this can be baffling for a British citizen, let alone someone from another country!

Firstly, I feel it important to state that we NEVER use a three-character abbreviation system for our counties. As such, these abbreviations are not only non-standard, they are very unhelpful. As I use Location to give the address of a venue, I don't want it outputting what is essentially gibberish.

Likewise, it isn't very helpful if the data has been arranged alphabetically as follows:

London, City Of

As the autocomplete field searches the entire record, what is the point in this? All it does is makes addresses look weird, e.g.:

1 Fake Street
City of London, W1

becomes:

1 Fake Street
London, City of, W1

There are, indeed, several ideas of what counties we have and some that are no longer in use, along with other boundaries that are not technically counties. Most notably:

  • Historical counties of England
  • Administritive counties of England created by the Local Government Act 1988
  • Metropolitan counties of England created by the Local Government Act 1972, and further sub-divided into non-metropolitan (or shire) counties
  • Ceremonial counties of England created by the Lieutenancies Act 1997
  • Former postal counties of the United Kingdom used by the Royal Mail from 1974 until 1996

(N.B. whilst I only mentioned England, counties in Wales, at the very least, were established at the same, or similar times.)

Whilst the ceremonial counties may be the actual counties in existence today and the Post Office no longer officially use counties, the list now known as former postal counties of the United Kingdom is still in wide use. The former postal counties are recognized by Google Maps and are often still used when addressing mail. Therefore, I would recommend the use of the former postal codes.

As has been mentioned before, the Welsh counties have changed significantly in recent years. However, the formal postal counties list uses the preserved counties of Wales.

The former postal counties, along with abbreviations, are as follows:

County Abbreviation Country
Avon   England
Bedfordshire Beds England
Berkshire Berks England
Buckinghamshire Bucks England
Cambridgeshire Cambs England
Cheshire   England
Cleveland   England
Cornwall   England
County Durham Co Durham England
Cumbria   England
Derbyshire   England
Devon   England
Dorset   England
East Sussex E Sussex England
Essex   England
Gloucestershire Glos England
Hampshire Hants England
Herefordshire   England
Hertfordshire Herts England
Isle of Wight   England
Kent   England
Lancashire Lancs England
Leicestershire Leics England
Lincolnshire Lincs England
Merseyside   England
Middlesex Middx England
Norfolk   England
North Humberside N Humbs England
North Yorkshire N Yorks England
Northamptonshire Northants England
Northumberland Northumb England
Nottinghamshire Notts England
Oxfordshire Oxon England
Shropshire Salop England
Somerset   England
South Humberside S Humbs England
South Yorkshire S Yorks England
Staffordshire Staffs England
Suffolk   England
Surrey   England
Tyne and Wear Tyne & Wear England
Warwickshire Warks England
West Midlands W Mids England
West Sussex W Sussex England
West Yorkshire W Yorks England
Wiltshire Wilts England
Worcestershire Worcs England
Clwyd   Wales
Dyfed   Wales
Gwent   Wales
Gwynedd   Wales
Mid Glamorgan M Glam Wales
South Glamorgan S Glam Wales
Powys   Wales
West Glamorgan W Glam Wales
Aberdeenshire   Scotland
Angus   Scotland
Argyll   Scotland
Ayrshire   Scotland
Banffshire   Scotland
Berwickshire   Scotland
Bute   Scotland
Caithness   Scotland
Clackmannanshire   Scotland
Dumfriesshire   Scotland
Dunbartonshire   Scotland
East Lothian   Scotland
Fife   Scotland
Inverness-shire   Scotland
Kincardineshire   Scotland
Kinross-shire   Scotland
Kirkcudbrightshire   Scotland
Lanarkshire   Scotland
Midlothian   Scotland
Moray   Scotland
Nairnshire   Scotland
Orkney   Scotland
Peeblesshire   Scotland
Perthshire   Scotland
Renfrewshire   Scotland
Ross-shire   Scotland
Roxburghshire   Scotland
Selkirkshire   Scotland
Shetland   Scotland
Stirlingshire   Scotland
Sutherland   Scotland
West Lothian   Scotland
Wigtownshire   Scotland
County Antrim Co Antrim Northern Ireland
County Armagh Co Armagh Northern Ireland
County Down Co Down Northern Ireland
County Fermanagh Co Fermanagh Northern Ireland
County Londonderry Co Londonderry Northern Ireland
County Tyrone Co Tyrone Northern Ireland

Some notes about the above table:

  • I'm no expert on Scottish counties, and have seen Bute both included and omitted. I have, therefore, included it.
  • Likewise, I have omitted the Scottish Isles, as I believe is correct for the United Kingdom, which is generally just the mainland (with a few exceptions).
  • I have omitted Rutland, which was not on the official Post Office list. Rutland is a small county consisting of two towns, with a total population of less than 40,000. However, some lists once again include it, so it could be considered for inclusion. Google Maps recognizes Rutland, but if you put in a Rutland postcode, it is listed as Leicestershire - hence my omission.
  • East Riding is not officially a county. It was not on the Post Office list, either (being partially covered by North Humberside) and hence is not included.
  • Some counties (namely Avon, Bedfordshire, Cheshire and Cleveland) are not considered counties any more. However, they were on the Post Office list, and have therefore been included. This may explain why people keep mentioning their former omission.
  • Herefordshire and Worcestershire are not officially counties. However, they replaced the county Hereford and Worcester and have the powers of a county. They were on the Post Office list and, therefore, are included.
  • Northumberland is occasionally abbreviated as Northd. However, Northumb is the more traditional abbreviation.
  • London is not a county, but was the exception used on the Post Office list. However, it was also listed as a special exception that didn't need a county (see below), and is never listed twice on an address. Therefore, it has not been included.

Please note: accompanying the former postal counties list is usually a list of 110 special places. These towns and countries did not require a county when addressing, according to the Post Office. However, it appears they have been mistakenly added to the UK list in Location, hence people reporting towns being in the field. These places should NOT be included as counties:

Aberdeen, Aboyne, Antrim, Armagh, Ayr, Banff, Bath, Bedford, Belfast, Berwick-Upon-Tweed, Birmingham, Blackburn, Blackpool, Bolton, Bournemouth, Brighton, Briston, Bromley, Buckingham, Bushey, Cambridge, Cardiff, Carlisle, Chelmsford, Chester, Clackmannan, Colchester, Coventry, Crewe, Croydon, Dartford, Derby, Dumbarton, Dumfries, Dundee, Durham, Edinburgh, Ellesmere Port, Exeter, Falkirk, Glasgow, Gloucester, Guernsey, Hereford, Hertford, Hounslow, Huddersfield, Hull, Inverness, Ipswich, Isle of Man, Isles of Scilly, Jersey, Kinross, Kirkcudbright, Lanark, Lancaster, Leeds, Leicester, Lincoln, Liverpool, London, Londonderry, Luton, Manchester, Milton Keynes, Nairn, Neston, Newcastle Upon Tyne, Northampton, Norwich, Nottingham, Oldham, Orkney, Oxford, Peebles, Perth, Peterborough, Plymouth, Portsmouth, Preston, Reading, Redhill, Renfrew, Romford, Salford, Salisbury, Selkirk, Sheffield, Shetland, Shrewsbury, Slough, Southampton, Southend-On-Sea, Stafford, Stirling, Stoke-On-Trent, Strathdon, Sunderland, Swansea, Swindon, Torquay, Twickenham, Walsall, Warrington, Warwick, Watford, Wolverhampton, Worcester, York.

The Royal Mail included this data with their Postcode Address File (PAF), the list of all addresses in the UK, until recently. Their Alias File now includes references to traditional, administrative and postal counties. As such, the former postal counties list is very much still in use.

I propose that Location should be updated to include only the counties listed in the above table in the province autocomplete field. I will attempt to create a patch for this shortly.

Here are some references to UK counties:

http://en.wikipedia.org/wiki/List_of_counties_of_the_United_Kingdom
http://en.wikipedia.org/wiki/Postal_counties_of_the_United_Kingdom
http://en.wikipedia.org/wiki/Counties_of_the_United_Kingdom
http://en.wikipedia.org/wiki/Administrative_county
http://www.columbia.edu/kermit/ukcounties.html

hutch’s picture

Thanks for your very helpful comments.
The current dev version has an option in the configuration where you can choose to display full province/state/county or the abbreviated form (which is commonly used in the US). It appears to work OK
BTW Ceredigion is missing from Wales
If you do make a patch do it on the latest development version, preferably using git. I'll be happy to help with that.

imeldamayhem’s picture

Thanks for your comments, hutch.

The former postal counties list uses the preserved counties of Wales list (posted by yourself in #45). Ceredigion is covered by Dyfed, as are Carmathenshire and Pembrokeshire. As such, I only went for the 8 preserved counties of Wales. Being from England, I have to say that I'm only familiar with the preserved counties, those being the ones I'm used to seeing as part of addresses.

I agree that it is hard to choose which of the counties lists to use. Whilst the current counties list may seem the answer, I think you have to consider what the Location module will be used for. By and large, it is going to be for locating (or storing) addresses. Therefore, the most logical choice is the former postal counties list, as everyone (should!) know what county to write in their own address! (This would apply both to users filling in their own addresses and using the module to enter various locations, e.g. venues - the venue's website should have the correct county on it!)

The information on the current dev version is particularly interesting - I didn't know that as I'm not currently running it. Thank you for bringing it to my attention. Whilst some countries use an abbreviated form for regions (such as the USA, as you mentioned), we don't use it here in the UK at all, and as such there's no standard for such a list. Such abbreviations could cause confusion for my visitors, so I certainly welcome the option of using full county names!

I would go into further information on how UK postcodes work and the Royal Mail's guide to correct addressing (and why the Location module does not always provide adequately for these addresses), but I feel this would be straying from the issue at hand. However, I feel it relevant to reinforce the point made that technically you could get a letter to the correct building with just the building number or name and the postcode (but not necessarily the right person, if the building is divided into units). However, for Google Maps purposes, this wouldn't work! Google Maps will accept just a postcode and give you an approximate location, or it will accept just the street line and the town. Unfortunately, there are some duplicate town names in the UK, so an address such as 1 High Street, Faketown could exist in two (or more) towns. However, adding the county will remove this confusion (and allow Google Maps to locate the address). Therefore, the county is still of importance (and best used as per addresses) - but certainly should NOT be a required field.

hutch’s picture

It's all a rather typical British muddle ;-)
Ceredigion think they are a county, see http://www.ceredigion.gov.uk
So does Pembrokeshire, http://www.pembrokeshire.gov.uk/
And http://www.carmarthenshire.gov.uk/Pages/default.aspx

Dyfed was broken up in 1996 but still exists as a Police authority.
What a mess.

The development version of Location module is quite a lot less broken than the 'stable' version, a fresh release is long overdue.
The same goes for Gmap

I take your point on multiple occurences of place names, try searching for 'Newport' so using county names does help.

The three letter code is of course a nonsense for the UK but in programming using keys is essential, if the administrative area has a name change the displayed name can change without wrecking existing records.

I hope you can come up with a better $counties array than the existing one.

imeldamayhem’s picture

Haha, indeed!

Yes, Ceredigion is a county, as are Anglesey, Cardiganshire, Denbighshire, Flintshire, Monmouthshire and Pembrokeshire. However, none of them are on the preserved counties of Wales list, which is what the Post Office used for Wales (as part of the former postal counties list). There are similar issues in England (as I mentioned, Avon, Bedfordshire, Cheshire and Cleveland are no longer counties but are still on the list) and Scotland (Ross and Cromarty isn't on the list, but is partially covered by Ross-shire).

To further confound matters, there are other lists you could consider, for example the counties, boroughs, cities and other locations on the 1821 Land Tax Act:

http://www.parliament.uk/about/living-heritage/transformingsociety/priva... (and subsequent pages linked on the left)

or the current county councils:

http://en.wikipedia.org/wiki/List_of_county_councils_in_England

Although that only applies to England. You'd have to look at the unitary principal areas of Wales, too. Scotland hasn't had county councils since 1975, when they were replaced by regional councils, which were in turn replaced in 1996 by the unitary principal areas. Likewise, Northern Ireland hasn't had county councils since 1973, but they do still have district councils.

Phew!

I still say that the best system to use is the former postal counties list. However, I appreciate that there may be times where someone may prefer to go by a different list (for example, a website that listed county councils may have no need for former counties such as Avon, but may require current counties such as Ceredigion). Therefore, if time permits, I will attempt to release two (or more) patches for different circumstances. I believe it is necessary to have separate patches, as one patch containing all the possible counties could result in an undesirable result where users choose which they prefer. Say I wanted to see how many users I have in Ceredigion, or send them all a message, or have them see specific content. However, some of them have put that they're in Dyfed. That's not going to work!

Incidentally, a word on what's included in the United Kingdom:

This video actually explains it well:

http://www.youtube.com/watch?v=rNu8XDBSn10

Basically, for our purposes, the United Kingdom is England, Scotland, Wales and Northern Ireland, but not Jersey, Guernsey or the Isle of Man.

It's an exhausting issue to explain, and one I'm sure could continue to cause argument indefinitely, but it's actually quite an interesting one!

spessex’s picture

subscribing

Leo Pitt’s picture

I have read most of the comments in this thread ...

I've been importing a bunch of address data to my site, and have come across this issue while wandering why Berkshire isn't in there...

In my opinion, the aim of a UK list of counties on a website is basically to enable people to enter in their address with reasonable ease whilst eliminating obvious mis-spellings and the like. As someone else said, we shouldn't be trying to correct people on the anachronisms of the UK county system.

Do I choose my county as "Bristol" or "Avon" .. ? The module should allow both in my opinion, because for all practical purposes, I don't think it makes a lot of difference. For the UK, postcode is the important bit.

So personally my ideal situation for the location UK provinces list would be to cast the net wide, rather than limit ourself to any particular provider of address data, Royal Mail or otherwise. Is there any reason not to follow this approach?

I believe it is necessary to have separate patches, as one patch containing all the possible counties could result in an undesirable result where users choose which they prefer. Say I wanted to see how many users I have in Ceredigion, or send them all a message, or have them see specific content. However, some of them have put that they're in Dyfed. That's not going to work!

I hadn't thought of it that way ... But I have a question about your hypothetical example: if you wanted to see how many users you have in a certain location, the only reliable way to go about it would be using the postcode... So rather than frustrating the user by unnecessarily limiting their county options, wouldn't you just use the postcode (which is nearly always mandatory when gathering address data, and very reliable)?

Cheers

spessex’s picture

is this ever going to be fixed out of interest as I'm still not clear what's happening? I've tried the last 6x release and it still appears to much the same. Have I missed something in the conversation how to change it from state to county etc?

bramley’s picture

This has been driving me crazy. Just subscribing for now...

imeldamayhem’s picture

Apologies to those awaiting a solution... I had fully intended to release a patch, but ill health meant it had to be put on the back burner. I shall endeavour to get something completed relatively soon.

if you wanted to see how many users you have in a certain location, the only reliable way to go about it would be using the postcode... So rather than frustrating the user by unnecessarily limiting their county options, wouldn't you just use the postcode (which is nearly always mandatory when gathering address data, and very reliable)?

Postcode searches are very reliable for the intended area, but they aren't always practical. To understand why, let's look at how a postcode is made up....

A postcode starts with a 2 to 4 character outward code. This can be split into two parts - a 1 or 2 letter postcode area and a numberical postcode district, which is a number from 0 to 99. The outward code is used to get mail from the sorting office to the correct delivery office.

The second half is the inward code. This can also be split into two parts - a single digit postal sector and a two letter postcode unit, which is usually all or part of a road, but can be a single building (e.g. a large office block). The inward code is used by the delivery office to sort mail and give it to the right postman.

We can see that it is possible to use a postcode for searching on several layers - we could look at the general area with the outward code, even to an area encompassing several towns, or we can look at the inward code and get an area within a town.

What we can't do with a postcode search is look for everyone in a particular county. As I mentioned before, I'm not really au fait with Welsh areas and postcodes, so let's look at an example in England.

Kent has the CA, ME and TN postcode areas. On top of that, parts of DA and BR are in Kent, and other parts of these two postcode areas used to be in Kent, but are now in Greater London!

Therefore, we have two choices - do 5 searches for these postcode areas (or write a custom query to cover them all... and repeat for every other county!), or search for Kent (and accept that we're going to get a few people in Bromley who still think they're in Kent, and others who aren't).

Of course, the best place to illustrate the point is London - there are lots of postcode areas in both Inner and Outer London, but technically as I said previously, it shouldn't be counted as a county! Hmm.

So yes, we're still not at a perfect solution, but it does seem that a postcode search is great for districts, boroughs and smaller areas of towns, but a town search is best for towns//villages/cities and a county search is relatively good for finding people in a particlar county.

Once I've made my county patches, I might well go further and look into a way of grouping postcodes in counties!

podarok’s picture

Version: 6.x-3.1 » 7.x-3.x-dev

all feature requests should be rolled against latest 7.x-3.x-dev and after commit can be backported to 6.x branch

Status: Needs review » Needs work

The last submitted patch, 326665-40-uk_provinces.patch, failed testing.

welly’s picture

This appears to still not have been resolved in the latest dev and RC versions so I've made a patch to resolve this using the county list above.

welly’s picture

Category: feature » bug
Status: Needs work » Needs review
FileSize
10.26 KB

Forgot to update the status! Will reattach the patch and update.

podarok’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Category: bug » task
Priority: Normal » Critical
Status: Needs review » Needs work

#63 commited pushed to 7.x-3.x
Thanks!

This patch has to be ported to 6.x-3.x

welly’s picture

Cheers! I shall try and find time this week to port it to 6.x-3.x.

legolasbo’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing old D6 issues as D6 is end of life