Skip to content

Instantly share code, notes, and snippets.

@oeon
Created January 12, 2020 17:28
Show Gist options
  • Save oeon/461cfb8d7c6bcb4cc59aec79bdf29865 to your computer and use it in GitHub Desktop.
Save oeon/461cfb8d7c6bcb4cc59aec79bdf29865 to your computer and use it in GitHub Desktop.
where ESA is a polygon layer. Use PostGIS to test in/out
-- inside ESA
UPDATE htmp points SET esa = 'yes'
FROM
(SELECT DISTINCT(poi.*)
FROM vm_esa pol
JOIN htmp poi
ON (ST_Within(poi.geom, pol.geom))) inside
WHERE points.legacy_fulcrum_id = inside.legacy_fulcrum_id;
-- outside ESA
UPDATE htmp points SET esa = 'no'
FROM
(SELECT DISTINCT(htmp.*)
FROM htmp
LEFT JOIN vm_esa
ON ST_Intersects(htmp.geom, vm_esa.geom)
WHERE vm_esa.id IS NULL) outside
WHERE points.legacy_fulcrum_id = outside.legacy_fulcrum_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment