Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT 'intersection', st_intersection(a.geom,b.geom)
- FROM
- (
- SELECT 'a1' id, st_geomfromtext('POLYGON((10 10, 10 100, 50 100, 50 10, 10 10))',23700) geom
- UNION
- SELECT 'a2' id, st_geomfromtext('POLYGON((50 10, 50 100, 100 100, 100 10, 50 10))',23700) geom
- ) a,
- (
- SELECT 'b' id, st_geomfromtext('POLYGON((20 0, 20 50, 80 50, 80 0, 20 0))',23700) geom
- ) b
- vs
- SELECT a.id, st_union(b.geom) FROM
- table1 a
- INNER JOIN table2 b ON st_intersects(a.geom, b.geom) GROUP BY a.id)
- SELECT g.id, st_union(c.geom, g.geom)
- FROM g
- INNER JOIN table1 c ON c.id=g.id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement