Created
December 4, 2021 00:03
-
-
Save stelf/372c42b33ef5de3d9cf5925d0da84398 to your computer and use it in GitHub Desktop.
check spatial intersection consistency by making sure no duplicate rows are returned
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- listing only records that appear more than twice | |
-- in result which finds points within areas | |
-- | |
-- the partitioning allows us to figure the results | |
-- alongside corresponding dulplicate areas | |
-- | |
-- the n.type may be skipped, is included as aexample | |
select * from ( | |
select | |
p.pid, n.id, n.type, | |
count(p.pid) over (partition by p.pid) as pcnt | |
from | |
parcels p | |
inner join | |
neighborhoods n | |
on st_within(p.geometry, n.geometry)) | |
where pcnt > 1 | |
order by pcnt desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment