carmen-ruby / carmen

A repository of geographic regions for Ruby
Other
1.17k stars 276 forks source link

UK Counties & Cites Mixed Up #262

Open MatthewKennedy opened 6 years ago

MatthewKennedy commented 6 years ago

The UK data for subregions, pulled from the ISO data is using UK cities mixed in with UK Counties (UK Counties are the equivalent of U.S. States)

Lancashire (County), Bradford (City), Essex(County), Manchester (City), Leeds (City).

This list is not what would be seen in a drop-down selector for State or Region in an online checkout for example.

Address line 1: My Street Address Line 2: Flat Name City: Manchester State: Should be Lancashire (The County) but we also have the option for Manchester (City) in there. Zip (Post Code): MA01 3LK Country: United Kingdom

I noticed that the issue was raised in the past and closed but the issue is genuine as a UK citizen that list is not pure regions, its cities and counties all mixed up, what that would be used for who knows, and I believe it is missing West Yorkshire.

MrFehr commented 5 years ago

Did you have any luck solving this? I'm facing the same issue myself. Choosing GB as the ISO and it gives me England, England and Wales, Wiltshere and a few others as Counties/States. Annoying! Thinking I'm going to have to create my own ISO to get round it; did you try that and have any luck? Thanks

swcraig commented 5 years ago

Hi Folks,

Thanks for creating this issue. Since the data is pulled directly from a mirror of the ISO repository, carmen only reflects that view of the world.

@MrFehr when I query for the United Kingdom I get the following.

irb(main):005:0> pp Carmen::Country.named('United Kingdom').subregions
[<#Carmen::Region name="England and Wales" type="nation">,
 <#Carmen::Region name="England" type="country">,
 <#Carmen::Region name="Great Britain" type="nation">,
 <#Carmen::Region name="Northern Ireland" type="province">,
 <#Carmen::Region name="Scotland" type="country">,
 <#Carmen::Region name="United Kingdom" type="nation">,
 <#Carmen::Region name="Wales; Cymru" type="country">]

I don't see Wiltshere in there. Is this not the expected output?

As for the incorrect counties for the United Kingdom mentioned in the original issue description, Pull Requests are welcome to add data overlays to get this fixed. The way to do this is outlined in the wiki.

MrFehr commented 5 years ago

Hey @swcraig, just found this and it seems to have been fixed. The Gem I'm using however that has Carmen built-in is using version 1.1.1 though hence why it still has Wiltshere and Middlesex. Is there any reason why there is both England/Wales, and England and Wales? Or any easy way to remove just 'England and Wales' as I think it'll confuse users choosing their country.

Also, looking at this list, it's quite a mix of counties, cities, towns, London boroughs and unitary authorities, and also missing a lot of counties too. For example it has Bedford and Luton which are part of Bedfordshire, but it doesn't have Bedfordshire, only Central Bedfordshire, which isn't a place but a local authority.

I am happy redoing the list and contributing to the project, but just want to ensure I do it correctly. The current list for gb.yml is a mix; should I change this to counties, then create another sub-list for cities within those counties or?

swcraig commented 5 years ago

The locale/base/en/world/gb/eng.yml file you referenced reflects the ISO repository; at a glance the Wikipedia page for GB's ISO 3166-2 entry seems to list the same. The page also mentions that Bedfordshire was removed on 2010-06-30 (under "Changes"). Is this not expected?

In my experience the data coming from the ISO repository and what is expected as someone familiar with the region doesn't always line up; I unfortunately can't guess why/how the ISO data is updated or defined, carmen just blindly pulls it down.

MrFehr commented 5 years ago

@swcraig I see what you mean. Weird that the Wiki ISO 3166-2 entry lists it that way. Not that it's technically wrong, but as you say it doesn't line up compared to someone familiar with the region.

Doesn't matter, I'll try and build my own workaround. I have a client who handles shipping across the UK and needs accurate counties/cities as it affects postage. If I rely on the ISO it messes it up because say a customer is looking for Bedfordshire (like myself as I'm from Bedfordshire), I have never and would never look for Central Bedfordshire, so the user may get confused.

Anyway, thanks for your help and replies, it was very much appreciated. Enjoy your weekend!

MatthewKennedy commented 5 years ago

@MrFehr I had no luck with this issue, simply because my use case was a checkout system in an online store, and as you will most likely be aware UK postcodes are street accurate anyway, so in my opinion it was better to not offer a county dropdown list, than it was to offer one with a mixed list of cites and counties, with some of the key counties completely missing.

And when I thought about it, other locations are probably effected by this issue too and I would never know about it.