Created
April 1, 2020 19:06
-
-
Save caged/1e418bc5c048fed5ef2604a1902eb735 to your computer and use it in GitHub Desktop.
Revisions
-
caged created this gist
Apr 1, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ WITH bad_geometries AS (SELECT (a.p_geom).path[1] AS path, (a.p_geom).geom FROM ( SELECT st_dump(shape) AS p_geom FROM us_district_court_jurisdictions WHERE fid = 57 ) a), good_geometries AS ( SELECT shape AS geom FROM us_district_court_jurisdictions WHERE fid = 58 ), movable_polygon AS (SELECT * FROM bad_geometries WHERE path = 1), retained_polygon AS (SELECT * FROM bad_geometries WHERE path = 2) UPDATE us_district_court_jurisdictions set shape = CASE WHEN fid = 58 THEN st_multi(st_union(shape, m.geom)) WHEN fid = 57 THEN st_multi(r.geom) END FROM movable_polygon m, retained_polygon r WHERE fid IN (57, 58)