SHARE
TWEET

i

kijato Oct 23rd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. SELECT 'intersection', st_intersection(a.geom,b.geom)
  3. FROM
  4.   (
  5.     SELECT 'a1' id, st_geomfromtext('POLYGON((10 10, 10 100, 50 100, 50 10, 10 10))',23700) geom
  6.     UNION
  7.     SELECT 'a2' id, st_geomfromtext('POLYGON((50 10, 50 100, 100 100, 100 10, 50 10))',23700) geom
  8.   ) a,
  9.   (
  10.     SELECT 'b' id, st_geomfromtext('POLYGON((20 0, 20 50, 80 50, 80 0, 20 0))',23700) geom
  11.   ) b
  12.  
  13.  
  14. vs
  15.  
  16. SELECT a.id, st_union(b.geom) FROM
  17. table1 a
  18. INNER JOIN table2 b ON st_intersects(a.geom, b.geom) GROUP BY a.id)
  19. SELECT g.id, st_union(c.geom, g.geom)
  20. FROM g
  21. INNER JOIN table1 c ON c.id=g.id;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top