More

How do I select polygons that overlap by a specified percentage of overlap?

How do I select polygons that overlap by a specified percentage of overlap?


I have two polygon layers. One represents parcels, the other is a hazard zone. How do I return only parcels where more than 30% of the parcel area overlaps the hazard zone? For example a parcel with an area of 100,000 square feet with 35,000 square feet inside the hazard zone should be returned as it's 35% overlap. On the other hand, a parcel of 100,000 square feet with 5,000 square feet inside (overlapping) the hazard area should not be returned as it's only 5% overlap.

I tried st_intersects but, although I get the parcels that overlap the hazard are, I need to take into account the percentage of overlap. How do I compare areas of overlap versus parcel area?

select p.id from parcels p, hazard h where st_intersects(p.geom, h.geom)

You can calculate the interesection of both layers and compare it to the area of the original geometry.

SELECT p.id FROM parcels p JOIN hazard h ON ST_Intersects(p.geom, h.geom) WHERE ST_Area(ST_Intersection(p.geom, h.geom)) / ST_Area(p.geom) > 0.35;