Ireland county boundaries#

import os
from datetime import datetime, timezone
from zipfile import ZipFile
import geopandas as gpd
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import numpy as np
import pooch
from matplotlib import ticker
import climag.climag as cplt
# base data download directory
DATA_DIR = os.path.join("data", "boundaries")
GPKG_BOUNDARY = os.path.join(DATA_DIR, "boundaries_all.gpkg")

Counties - OSi National Statutory Boundaries - 2019#

https://data-osi.opendata.arcgis.com/datasets/osi::counties-osi-national-statutory-boundaries-2019/about

SUB_DIR = os.path.join(DATA_DIR, "OSi")
os.makedirs(SUB_DIR, exist_ok=True)
URL = (
    "https://opendata.arcgis.com/api/v3/datasets/"
    "e6f6418eb62442c4adbe18d0a64135a2_0/downloads/data?"
    "format=shp&spatialRefId=2157&where=1%3D1"
)
KNOWN_HASH = None
FILE_NAME = "counties-osi-national-statutory-boundaries-2019.zip"
# download data if necessary
if not os.path.isfile(os.path.join(SUB_DIR, FILE_NAME)):
    pooch.retrieve(
        url=URL, known_hash=KNOWN_HASH, fname=FILE_NAME, path=SUB_DIR
    )

    with open(
        os.path.join(SUB_DIR, f"{FILE_NAME[:-4]}.txt"), "w", encoding="utf-8"
    ) as outfile:
        outfile.write(
            f"Data downloaded on: {datetime.now(tz=timezone.utc)}\n"
            f"Download URL: {URL}"
        )
Downloading data from 'https://opendata.arcgis.com/api/v3/datasets/e6f6418eb62442c4adbe18d0a64135a2_0/downloads/data?format=shp&spatialRefId=2157&where=1%3D1' to file '/run/media/nms/Backup/Documents/Git/ClimAg/ClimAg/data/boundaries/OSi/counties-osi-national-statutory-boundaries-2019.zip'.
SHA256 hash of downloaded file: 7e382ae52ba37a35136d8c8bdeac899b59bdc6525e650314b008938717f73fa4
Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.
ZIP_FILE = os.path.join(
    SUB_DIR, "counties-osi-national-statutory-boundaries-2019.zip"
)
# list of files/folders in the ZIP archive
ZipFile(ZIP_FILE).namelist()
['Counties___OSi_National_Statutory_Boundaries_.shp',
 'Counties___OSi_National_Statutory_Boundaries_.shx',
 'Counties___OSi_National_Statutory_Boundaries_.dbf',
 'Counties___OSi_National_Statutory_Boundaries_.cpg',
 'Counties___OSi_National_Statutory_Boundaries_.prj',
 'Counties_-_OSi_National_Statutory_Boundaries_-_2019.xml']
osi = gpd.read_file(
    f"zip://{ZIP_FILE}!Counties___OSi_National_Statutory_Boundaries_.shp"
)
osi
OBJECTID CO_ID ENGLISH GAEILGE LOGAINM_ID GUID CONTAE COUNTY PROVINCE CENTROID_X CENTROID_Y AREA SHAPE_Leng SHAPE_Area geometry
0 1 50000 DONEGAL Dún na nGall 100013 2ae19629-1452-13a3-e055-000000000001 Dún na nGall DONEGAL Ulster 607296.31 911848.45 4.860754e+09 1.859119e+06 4.860754e+09 MULTIPOLYGON (((594809.032 934698.617, 594809....
1 2 120000 LIMERICK Luimneach 100022 2ae19629-1440-13a3-e055-000000000001 Luimneach LIMERICK Munster 548318.75 640943.05 2.754926e+09 3.897987e+05 2.754926e+09 POLYGON ((565662.328 665775.167, 565663.255 66...
2 3 80000 KILDARE Cill Dara 100007 2ae19629-1455-13a3-e055-000000000001 Cill Dara KILDARE Leinster 678993.60 712090.40 1.694083e+09 2.970485e+05 1.694083e+09 POLYGON ((700193.727 734740.683, 700202.676 73...
3 4 220000 WATERFORD Port Láirge 100026 2ae19629-144b-13a3-e055-000000000001 Port Láirge WATERFORD Munster 630336.80 599955.37 1.857038e+09 4.572206e+05 1.857038e+09 MULTIPOLYGON (((627774.638 593971.494, 627777....
4 5 260000 DUBLIN Baile Átha Cliath 100002 2ae19629-144f-13a3-e055-000000000001 Baile Átha Cliath DUBLIN Leinster 714929.28 740960.44 9.257609e+08 3.661986e+05 9.257609e+08 MULTIPOLYGON (((703019.336 739044.540, 703020....
5 6 230000 WESTMEATH An Iarmhí 100016 2ae19629-144c-13a3-e055-000000000001 An Iarmhí WESTMEATH Leinster 635445.42 756679.97 1.838310e+09 2.916598e+05 1.838310e+09 POLYGON ((641367.591 732152.211, 641366.980 73...
6 7 170000 MONAGHAN Muineachán 100025 2ae19629-1445-13a3-e055-000000000001 Muineachán MONAGHAN Ulster 669110.41 824170.57 1.294164e+09 3.009820e+05 1.294164e+09 POLYGON ((675935.046 835570.097, 675941.324 83...
7 8 250000 WICKLOW Cill Mhantáin 100008 2ae19629-144e-13a3-e055-000000000001 Cill Mhantáin WICKLOW Leinster 707784.79 690738.10 2.025161e+09 3.206300e+05 2.025161e+09 MULTIPOLYGON (((725064.152 671911.669, 725060....
8 9 40000 CORK Corcaigh 100010 2ae19629-1451-13a3-e055-000000000001 Corcaigh CORK Munster 527532.69 573117.78 7.502635e+09 1.962542e+06 7.502635e+09 MULTIPOLYGON (((539837.098 620406.502, 539820....
9 10 70000 KERRY Ciarraí 100005 2ae19629-1454-13a3-e055-000000000001 Ciarraí KERRY Munster 469696.21 600519.77 4.812989e+09 1.521123e+06 4.812989e+09 MULTIPOLYGON (((444169.720 600758.236, 444174....
10 11 190000 ROSCOMMON Ros Comáin 100027 2ae19629-1447-13a3-e055-000000000001 Ros Comáin ROSCOMMON Connacht 576872.92 772072.39 2.547136e+09 4.305319e+05 2.547136e+09 POLYGON ((567931.477 797012.547, 567944.435 79...
11 12 240000 WEXFORD Loch Garman 100019 2ae19629-144d-13a3-e055-000000000001 Loch Garman WEXFORD Leinster 696261.93 634655.15 2.369838e+09 4.279792e+05 2.369838e+09 MULTIPOLYGON (((713562.446 612625.823, 713567....
12 13 130000 LONGFORD An Longfort 100020 2ae19629-1441-13a3-e055-000000000001 An Longfort LONGFORD Leinster 619420.92 775835.13 1.091078e+09 2.130448e+05 1.091078e+09 POLYGON ((607949.238 781479.058, 607874.731 78...
13 14 160000 MEATH An Mhí 100024 2ae19629-1444-13a3-e055-000000000001 An Mhí MEATH Leinster 680723.14 767236.28 2.342049e+09 3.965384e+05 2.342049e+09 POLYGON ((703693.547 775679.647, 703715.407 77...
14 15 20000 CAVAN An Cabhán 100003 2ae19629-1448-13a3-e055-000000000001 An Cabhán CAVAN Ulster 638764.82 809776.33 1.931225e+09 3.766452e+05 1.931225e+09 POLYGON ((647101.835 817295.342, 647136.479 81...
15 16 10000 CARLOW Ceatharlach 100004 2ae19629-143d-13a3-e055-000000000001 Ceatharlach CARLOW Leinster 680448.23 660624.58 8.963062e+08 2.245240e+05 8.963062e+08 POLYGON ((670647.949 643416.565, 670650.103 64...
16 17 150000 MAYO Maigh Eo 100023 2ae19629-1443-13a3-e055-000000000001 Maigh Eo MAYO Connacht 504948.11 797843.38 5.587525e+09 1.637391e+06 5.587525e+09 MULTIPOLYGON (((474351.488 830956.119, 474354....
17 18 140000 LOUTH 100021 2ae19629-1442-13a3-e055-000000000001 LOUTH Leinster 705050.25 796448.45 8.261070e+08 2.554320e+05 8.261070e+08 MULTIPOLYGON (((705398.558 808067.244, 705397....
18 19 200000 SLIGO Sligeach 100028 2ae19629-1449-13a3-e055-000000000001 Sligeach SLIGO Connacht 557897.46 827219.69 1.836083e+09 5.196672e+05 1.836083e+09 MULTIPOLYGON (((587808.346 819441.502, 587826....
19 20 110000 LEITRIM Liatroim 100018 2ae19629-143f-13a3-e055-000000000001 Liatroim LEITRIM Connacht 599762.02 821266.52 1.588030e+09 3.217761e+05 1.588030e+09 MULTIPOLYGON (((601354.743 793462.633, 601338....
20 21 90000 KILKENNY Cill Chainnigh 100006 2ae19629-1456-13a3-e055-000000000001 Cill Chainnigh KILKENNY Leinster 647885.56 646646.11 2.071100e+09 2.866875e+05 2.071100e+09 POLYGON ((657278.307 614454.867, 657275.738 61...
21 22 180000 OFFALY Uíbh Fhailí 100031 2ae19629-1446-13a3-e055-000000000001 Uíbh Fhailí OFFALY Leinster 631261.72 709672.35 2.000025e+09 3.899277e+05 2.000025e+09 POLYGON ((601397.409 731850.464, 601413.034 73...
22 23 100000 LAOIS Laois 100017 2ae19629-143e-13a3-e055-000000000001 Laois LAOIS Leinster 644908.26 694308.36 1.719127e+09 2.767380e+05 1.719127e+09 POLYGON ((661099.539 694862.944, 661101.021 69...
23 24 60000 GALWAY Gaillimh 100015 2ae19629-1453-13a3-e055-000000000001 Gaillimh GALWAY Connacht 524511.96 732839.34 6.150926e+09 2.134611e+06 6.150926e+09 MULTIPOLYGON (((454124.489 757209.338, 454128....
24 25 210000 TIPPERARY Tiobraid Árann 100029 2ae19629-144a-13a3-e055-000000000001 Tiobraid Árann TIPPERARY Munster 605191.54 659297.87 4.303396e+09 5.177914e+05 4.303396e+09 POLYGON ((616930.981 621074.522, 616922.325 62...
25 26 30000 CLARE An Clár 100009 2ae19629-1450-13a3-e055-000000000001 An Clár CLARE Munster 524790.20 680078.02 3.448615e+09 5.279467e+05 3.448615e+09 MULTIPOLYGON (((549953.941 658520.164, 549819....
osi.crs
<Derived Projected CRS: EPSG:2157>
Name: IRENET95 / Irish Transverse Mercator
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Ireland - onshore. United Kingdom (UK) - Northern Ireland (Ulster) - onshore.
- bounds: (-10.56, 51.39, -5.34, 55.43)
Coordinate Operation:
- name: Irish Transverse Mercator
- method: Transverse Mercator
Datum: IRENET95
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
base = osi.plot(
    color="navajowhite",
    figsize=(9, 9),
    edgecolor="darkslategrey",
    linewidth=0.4,
)

plt.tick_params(labelbottom=False, labelleft=False)
plt.title("Counties of the Republic of Ireland")
plt.text(650000, 505000, "© Ordnance Survey Ireland")

plt.tight_layout()
plt.show()
../_images/ab88116fef02eee4cf86e3ab9cc2c8f35019ddf59d87ff7b2c4cd0f10eebdc0a.png

OSNI Open Data - Largescale Boundaries - County Boundaries#

https://www.opendatani.gov.uk/dataset/osni-open-data-largescale-boundaries-county-boundaries1

SUB_DIR = os.path.join(DATA_DIR, "OSNI")
os.makedirs(SUB_DIR, exist_ok=True)
URL = (
    "https://osni-spatialni.opendata.arcgis.com/datasets/"
    "spatialni::osni-open-data-largescale-boundaries-county-boundaries-.zip?"
    'outSR={"latestWkid":29902,"wkid":29900}'
)
KNOWN_HASH = None
FILE_NAME = "osni-open-data-largescale-boundaries-county-boundaries.zip"
# download data if necessary
if not os.path.isfile(os.path.join(SUB_DIR, FILE_NAME)):
    pooch.retrieve(
        url=URL, known_hash=KNOWN_HASH, fname=FILE_NAME, path=SUB_DIR
    )

    with open(
        os.path.join(SUB_DIR, f"{FILE_NAME[:-4]}.txt"), "w", encoding="utf-8"
    ) as outfile:
        outfile.write(
            f"Data downloaded on: {datetime.now(tz=timezone.utc)}\n"
            f"Download URL: {URL}"
        )
Downloading data from 'https://osni-spatialni.opendata.arcgis.com/datasets/spatialni::osni-open-data-largescale-boundaries-county-boundaries-.zip?outSR={"latestWkid":29902,"wkid":29900}' to file '/run/media/nms/Backup/Documents/Git/ClimAg/ClimAg/data/boundaries/OSNI/osni-open-data-largescale-boundaries-county-boundaries.zip'.
SHA256 hash of downloaded file: 41ddbfdeac4e86d8cc3d17ad3d3b2db8dcd523219bc9119a12065452230bd002
Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.
ZIP_FILE = os.path.join(SUB_DIR, FILE_NAME)
# list of files/folders in the ZIP archive
ZipFile(ZIP_FILE).namelist()
['OSNI_Open_Data_-_Largescale_Boundaries_-_County_Boundaries_.shp',
 'OSNI_Open_Data_-_Largescale_Boundaries_-_County_Boundaries_.shx',
 'OSNI_Open_Data_-_Largescale_Boundaries_-_County_Boundaries_.dbf',
 'OSNI_Open_Data_-_Largescale_Boundaries_-_County_Boundaries_.cpg',
 'OSNI_Open_Data_-_Largescale_Boundaries_-_County_Boundaries_.prj',
 'OSNI_Open_Data_-_Largescale_Boundaries_-_County_Boundaries_.xml']
osni = gpd.read_file(
    f"zip://{ZIP_FILE}!OSNI_Open_Data_-_Largescale_Boundaries_-_"
    "County_Boundaries_.shp"
)
osni
COUNTY_ID CountyName Area_SqKM OBJECTID geometry
0 6 TYRONE 3265.796622 1 POLYGON ((239669.119 410673.911, 239674.087 41...
1 1 ANTRIM 3097.847750 2 MULTIPOLYGON (((332496.979 369026.840, 332495....
2 2 ARMAGH 1327.228438 3 POLYGON ((306664.851 363565.186, 306800.000 36...
3 4 FERMANAGH 1850.832538 4 POLYGON ((219812.322 373029.105, 219829.775 37...
4 5 LONDONDERRY 2118.316853 5 POLYGON ((284790.378 439909.102, 284790.998 43...
5 3 DOWN 2491.238606 6 MULTIPOLYGON (((325844.559 312608.723, 325840....
osni.crs
<Derived Projected CRS: EPSG:29902>
Name: TM65 / Irish Grid
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Ireland - onshore.
- bounds: (-10.56, 51.39, -5.93, 55.43)
Coordinate Operation:
- name: Irish Grid
- method: Transverse Mercator
Datum: TM65
- Ellipsoid: Airy Modified 1849
- Prime Meridian: Greenwich
# rename Londonderry to Derry
osni.replace("LONDONDERRY", "DERRY", inplace=True)
base = osni.plot(
    color="navajowhite",
    figsize=(7.5, 7.5),
    edgecolor="darkslategrey",
    linewidth=0.4,
)

plt.tick_params(labelbottom=False, labelleft=False)
plt.title("Counties of Northern Ireland")
plt.text(312000, 305000, "© Ordnance Survey Northern Ireland")

plt.tight_layout()
plt.show()
../_images/d1f714b7f56f0f9a246131ba9edcd7f7c5a93d300ffab0aeededbf40051a8abe.png

County boundaries - Island of Ireland#

osi_counties = osi[["CONTAE", "COUNTY", "PROVINCE", "geometry"]]
osi_counties
CONTAE COUNTY PROVINCE geometry
0 Dún na nGall DONEGAL Ulster MULTIPOLYGON (((594809.032 934698.617, 594809....
1 Luimneach LIMERICK Munster POLYGON ((565662.328 665775.167, 565663.255 66...
2 Cill Dara KILDARE Leinster POLYGON ((700193.727 734740.683, 700202.676 73...
3 Port Láirge WATERFORD Munster MULTIPOLYGON (((627774.638 593971.494, 627777....
4 Baile Átha Cliath DUBLIN Leinster MULTIPOLYGON (((703019.336 739044.540, 703020....
5 An Iarmhí WESTMEATH Leinster POLYGON ((641367.591 732152.211, 641366.980 73...
6 Muineachán MONAGHAN Ulster POLYGON ((675935.046 835570.097, 675941.324 83...
7 Cill Mhantáin WICKLOW Leinster MULTIPOLYGON (((725064.152 671911.669, 725060....
8 Corcaigh CORK Munster MULTIPOLYGON (((539837.098 620406.502, 539820....
9 Ciarraí KERRY Munster MULTIPOLYGON (((444169.720 600758.236, 444174....
10 Ros Comáin ROSCOMMON Connacht POLYGON ((567931.477 797012.547, 567944.435 79...
11 Loch Garman WEXFORD Leinster MULTIPOLYGON (((713562.446 612625.823, 713567....
12 An Longfort LONGFORD Leinster POLYGON ((607949.238 781479.058, 607874.731 78...
13 An Mhí MEATH Leinster POLYGON ((703693.547 775679.647, 703715.407 77...
14 An Cabhán CAVAN Ulster POLYGON ((647101.835 817295.342, 647136.479 81...
15 Ceatharlach CARLOW Leinster POLYGON ((670647.949 643416.565, 670650.103 64...
16 Maigh Eo MAYO Connacht MULTIPOLYGON (((474351.488 830956.119, 474354....
17 LOUTH Leinster MULTIPOLYGON (((705398.558 808067.244, 705397....
18 Sligeach SLIGO Connacht MULTIPOLYGON (((587808.346 819441.502, 587826....
19 Liatroim LEITRIM Connacht MULTIPOLYGON (((601354.743 793462.633, 601338....
20 Cill Chainnigh KILKENNY Leinster POLYGON ((657278.307 614454.867, 657275.738 61...
21 Uíbh Fhailí OFFALY Leinster POLYGON ((601397.409 731850.464, 601413.034 73...
22 Laois LAOIS Leinster POLYGON ((661099.539 694862.944, 661101.021 69...
23 Gaillimh GALWAY Connacht MULTIPOLYGON (((454124.489 757209.338, 454128....
24 Tiobraid Árann TIPPERARY Munster POLYGON ((616930.981 621074.522, 616922.325 62...
25 An Clár CLARE Munster MULTIPOLYGON (((549953.941 658520.164, 549819....
osni_counties = osni.rename(columns={"CountyName": "COUNTY"})
osni_counties = osni_counties[["geometry", "COUNTY"]]
# https://en.wikipedia.org/wiki/Counties_of_Ireland
contae = {
    "ANTRIM": "Aontroim",
    "ARMAGH": "Ard Mhacha",
    "DOWN": "An Dún",
    "FERMANAGH": "Fear Manach",
    "DERRY": "Doire",
    "TYRONE": "Tír Eoghain",
}
osni_counties["CONTAE"] = osni_counties["COUNTY"].map(contae)
osni_counties["PROVINCE"] = "Ulster"
osni_counties
geometry COUNTY CONTAE PROVINCE
0 POLYGON ((239669.119 410673.911, 239674.087 41... TYRONE Tír Eoghain Ulster
1 MULTIPOLYGON (((332496.979 369026.840, 332495.... ANTRIM Aontroim Ulster
2 POLYGON ((306664.851 363565.186, 306800.000 36... ARMAGH Ard Mhacha Ulster
3 POLYGON ((219812.322 373029.105, 219829.775 37... FERMANAGH Fear Manach Ulster
4 POLYGON ((284790.378 439909.102, 284790.998 43... DERRY Doire Ulster
5 MULTIPOLYGON (((325844.559 312608.723, 325840.... DOWN An Dún Ulster
# reproject to Irish Transverse Mercator
osi_counties = osi_counties.to_crs(cplt.ITM_EPSG)
osni_counties = osni_counties.to_crs(cplt.ITM_EPSG)
# remove overlapping areas in OSi layer
osi_counties = osi_counties.overlay(osni_counties, how="difference")
# merge county layers
ie_counties = osi_counties.merge(osni_counties, how="outer")
ie_counties
CONTAE COUNTY PROVINCE geometry
0 Dún na nGall DONEGAL Ulster MULTIPOLYGON (((668515.913 943718.890, 668514....
1 Luimneach LIMERICK Munster POLYGON ((565662.328 665775.167, 565663.255 66...
2 Cill Dara KILDARE Leinster POLYGON ((700193.727 734740.683, 700202.676 73...
3 Port Láirge WATERFORD Munster MULTIPOLYGON (((627774.638 593971.494, 627777....
4 Baile Átha Cliath DUBLIN Leinster MULTIPOLYGON (((730410.012 750574.906, 730401....
5 An Iarmhí WESTMEATH Leinster POLYGON ((641367.591 732152.211, 641366.980 73...
6 Muineachán MONAGHAN Ulster MULTIPOLYGON (((675985.454 835478.726, 676014....
7 Cill Mhantáin WICKLOW Leinster MULTIPOLYGON (((725064.152 671911.669, 725060....
8 Corcaigh CORK Munster MULTIPOLYGON (((539837.098 620406.502, 539820....
9 Ciarraí KERRY Munster MULTIPOLYGON (((444169.720 600758.236, 444174....
10 Ros Comáin ROSCOMMON Connacht POLYGON ((567931.477 797012.547, 567944.435 79...
11 Loch Garman WEXFORD Leinster MULTIPOLYGON (((713562.446 612625.823, 713567....
12 An Longfort LONGFORD Leinster POLYGON ((607949.238 781479.058, 607874.731 78...
13 An Mhí MEATH Leinster POLYGON ((703693.547 775679.647, 703715.407 77...
14 An Cabhán CAVAN Ulster POLYGON ((647136.479 817286.624, 647138.142 81...
15 Ceatharlach CARLOW Leinster POLYGON ((670647.949 643416.565, 670650.103 64...
16 Maigh Eo MAYO Connacht MULTIPOLYGON (((474351.488 830956.119, 474354....
17 LOUTH Leinster MULTIPOLYGON (((705394.964 808058.738, 705392....
18 Sligeach SLIGO Connacht MULTIPOLYGON (((587808.346 819441.502, 587826....
19 Liatroim LEITRIM Connacht MULTIPOLYGON (((601338.957 793490.080, 601300....
20 Cill Chainnigh KILKENNY Leinster POLYGON ((657278.307 614454.867, 657275.738 61...
21 Uíbh Fhailí OFFALY Leinster POLYGON ((601397.409 731850.464, 601413.034 73...
22 Laois LAOIS Leinster POLYGON ((661099.539 694862.944, 661101.021 69...
23 Gaillimh GALWAY Connacht MULTIPOLYGON (((454124.489 757209.338, 454128....
24 Tiobraid Árann TIPPERARY Munster POLYGON ((616930.981 621074.522, 616922.325 62...
25 An Clár CLARE Munster MULTIPOLYGON (((549953.941 658520.164, 549819....
26 Tír Eoghain TYRONE Ulster POLYGON ((639612.422 910662.630, 639617.389 91...
27 Aontroim ANTRIM Ulster MULTIPOLYGON (((732420.063 869024.039, 732419....
28 Ard Mhacha ARMAGH Ulster POLYGON ((706593.471 863563.699, 706728.591 86...
29 Fear Manach FERMANAGH Ulster POLYGON ((619759.703 873026.040, 619777.153 87...
30 Doire DERRY Ulster POLYGON ((684724.116 939891.284, 684724.736 93...
31 An Dún DOWN Ulster MULTIPOLYGON (((725768.776 812618.113, 725765....
# new colour map
# https://stackoverflow.com/a/31052741
# sample the colormaps that you want to use. Use 20 from each so we get 40
# colors in total
colors1 = plt.cm.tab20b(np.linspace(0.0, 1, 20))
colors2 = plt.cm.tab20c(np.linspace(0, 1, 20))

# combine them and build a new colormap
colors = np.vstack((colors1, colors2))
# categorical map - labels directly on plot
base = ie_counties.plot(
    cmap=mcolors.ListedColormap(colors),
    edgecolor="white",
    linewidth=0.4,
    figsize=(9, 9),
    column="COUNTY",
    alpha=0.45,
)

map_labels = zip(
    zip(ie_counties.centroid.x, ie_counties.centroid.y), ie_counties["COUNTY"]
)
for xy, lab in map_labels:
    base.annotate(text=lab, xy=xy, textcoords="data", rotation=10, ha="center")

plt.tick_params(labelbottom=False, labelleft=False)
plt.title("Counties of Ireland")
plt.text(
    612500,
    502500,
    "© Ordnance Survey Ireland\n© Ordnance Survey Northern Ireland",
)

plt.show()
../_images/e8e519e0ab83ea4a4b97337a8869f6423f3424826ec826867a2bc12ce2d6b7f4.png
ie_counties.crs
<Derived Projected CRS: EPSG:2157>
Name: IRENET95 / Irish Transverse Mercator
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Ireland - onshore. United Kingdom (UK) - Northern Ireland (Ulster) - onshore.
- bounds: (-10.56, 51.39, -5.34, 55.43)
Coordinate Operation:
- name: Irish Transverse Mercator
- method: Transverse Mercator
Datum: IRENET95
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
ie_counties.to_file(GPKG_BOUNDARY, layer="OSi_OSNI_IE_Counties_2157")