I'm a newbie, apologies if this is obvious/has already been asked and answered but I couldn't find anything.
I have two shapefiles: 1. an administrative boundary layer for a county in the UK known as an LSOA boundary that has 500 little zones in it 2. a flood zone.
Ideally I want to find out which of the little LSOA zones are ≥50% within the flood zone and end up with a yes/no or a 1/0 for each of the 500 LSOA zones.
But I don't know how to do this. I figured I could Join the two shapefiles, but there's no common attribute between them. Then I thought I could use the Join Attribute by Location function, which worked and shows me which LSOA are in the flood zone, but that's nearly all of them (see image 2).
I think this is an SQL problem but I don't know. I'm new to QGIS and have never used PostgreSQL.
Any help would be greatly appreciated. I can provide whatever info you lovely people need to help me out.
Answer
This is a relatively simple task using the geoprocessing tools included in QGIS.
Calculate the area of your LSOA zones.
- Open the LSOA layer attribute table.
- Enable editing mode.
- Open the field calculator.
- Create a new field of type "Decimal number (real)" with the expression "$area".
- Disable editing mode (saving edits).
Merge the flood zone layer into a single multi-part feature.
Vector > Geometry Tools > Singleparts to Multipart
.- Select "--- Merge all ---" for the Unique ID field.
Intersect the LSOA zone layer with the multipart flood zone layer.
Vector > Geoprocessing Tools > Intersect
.- Input layer is the LSOA zones, intersect layer is the flood zones.
The resulting layer will be the parts of the LSOA zones (with the attributes from the LSOA zones layer) which overlapped with the flood zones layer. To calculate the proportion of each LSOA zone within a flood zone:
- Calculate the area of the intersected features (as in step #1), then
- Add another field, dividing the original (total) area by the intersected area. The result is a decimal between 0 and 1. Multiply by 100 to give a percentage.
Join the original LSOA layer to the intersected layer, using the unique ID shared by both layers.
Export the joined layer as a new shapefile.
Delete the duplicated attributes.
Et voilĂ !
Without step #2, an individual feature would be created for each different flood zone feature for each LSOA feature. This probably isn't what you want if you're only interested in the total coverage for each LSOA zone. If you want to differentiate between fluvial / tidal / pluvial flooding (and the flood zone data supports it), you could convert singlepart s to multipart specifying the "TYPE" field as the Unique ID field.
No comments:
Post a Comment