I have two large-ish shapefiles.
Shapefile 1:
One can be downloaded from here:
https://data.statistik.gv.at/data/OGDEXT_DSR_1_STATISTIK_AUSTRIA_20111031.zip
- It is ~20 MB in size
- Seems to be super detailed
- It has three features (classes of settlement) and two columns
When I print the object it takes forever to load the output which looks roughly like this:
Simple feature collection with 3 features and 2 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: 112294.6 ymin: 275328.4 xmax: 685584 ymax: 570580.4
Projected CRS: SOURCECRS
Shapefile 2:
- can be downloaded from here: https://data.statistik.gv.at/data/OGDEXT_GEM_1_STATISTIK_AUSTRIA_20220101.zip
- Is roughly 61 MB in size
- Has 2115 Features (2115 administrative areas in Austria) and two columns
- When I print it, it prints the output much faster (why?! when its bigger), which looks like this:
Simple feature collection with 2115 features and 2 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: 112518.2 ymin: 275472 xmax: 685444.5 ymax: 570431.1
Projected CRS: SOURCECRS
Now I would like to find out how much area of each polygon is intersecting with each class in the first shapefile (the settlement layer). A normal st_intersection()
takes way too long. It did not finish and I let it run for the entire day.
How do I speed this up, perhaps by chunking up some layers?
st_intersection
function that you tried? Its possible that splitting the features into POLYGON geometry (89361 of them) might be faster.