4

What I want to do is make the purple layer at the back having the same shape as the transparent layer.

However, I don't want any attributes of the transparent layer to be joined to the purple layer, is there any command I can use in Postgis to achieve this? enter image description here

  • 'attributes of the transparent layer to be joined to the purple layer" how do you want one layer to see the other? This obviously requires a join. You can't operate on two layers without joining them. – Evan Carroll Jan 18 '17 at 1:55
  • Does this query return all original table columns as well? it sounds like it is just replacing the geometry and therefore all original table attributes should pass through as well or is it just returning geometry? – flyfishwv May 30 at 13:35
7

Just figured it out. Not sure if it helps anyone by answering my own question

UPDATE blue b
SET geom = ST_Intersection(b.geom, p.geom)
FROM purple p
WHERE ST_Intersects(b.geom, p.geom);

It gets the geometry of the intersection and use it to replace the one in the original table

  • You can accept your own answer with the checkbox – BERA Nov 13 '18 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.