I have been performing spatial joins but there is a problem. The geometries of both layers are slightly misaligned. I would like to join by location where parcels
are within historic_subdistricts
and to keep both matching and non matching records. The query below works but the problem is that ST_Within
only works if geometry of one layer is completely contained by the other.
CREATE TABLE test_join AS
SELECT t.*, m.*
FROM parcels AS t
LEFT JOIN historic_subdistricts= AS m
ON ST_Within(t.geom, m.geom)
How would one write a query to perform a spatial join if 90% of the area of a parcel in parcels
is within a subdistrict in historic_subdistricts
?
Here is a visualization of the problem: