Vector layer to mask out non-pasture areas#

import os
import geopandas as gpd
import matplotlib.pyplot as plt
# vectorised layer of pastures based on CLC 2018 data
pastures = gpd.read_file(
    os.path.join("data", "landcover", "clc-2018-pasture.gpkg"),
    layer="dissolved",
)
pastures.to_crs(2157, inplace=True)
# Ireland boundary
ie = gpd.read_file(
    os.path.join("data", "boundaries", "boundaries_all.gpkg"),
    layer="NUTS_RG_01M_2021_2157_IE",
)
# non-pasture area mask
ie_ = ie.overlay(pastures, how="symmetric_difference")
ie_.plot()
plt.tick_params(labelbottom=False, labelleft=False)
plt.tight_layout()
plt.show()
../_images/e766d6a103dbcfc95440b794519c2a1084d3f54fc85f3a19a254340eb69304ae.png
ie_.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_.to_file(
    os.path.join("data", "boundaries", "boundaries_all.gpkg"),
    layer="CLC_2018_MASK_PASTURE_2157_IE",
)