6

In QGIS 3 does anyone know how to copy the geometry of one feature and paste it into another selected feature to just override the geometry? Within postgis I did this with an update, but I'm looking for a visual way in QGIS. Simply copy and paste. The only solution I found, is to insert the copy of a feature as a new entry, edit the missing attributes and delete the old one.

5
  • Are you looking to script this or are you after an existing tool/workflow? Is this for only one feature selected interactively or for all features in a layer? Oct 1 '18 at 11:09
  • I'm looking for a most easy workflow just to change the geometry of one selected feature. To do this with the edit toolbar 'copy' and then 'paste' with a selected feature adds just a new entry and doesn't overrides it.
    – Michael
    Oct 1 '18 at 11:21
  • No, not really. The question of the first one seems to go into my direction, but the answer explains the insert of a copy as a new feature. The second one is to merge two layers together where to take the attributes from one layer and the geometry of another.
    – Michael
    Oct 1 '18 at 11:54
  • 1
    It sounds like you've already found the easiest way to do this. To simplify any further, you would have to code an entirely new tool.
    – csk
    Oct 1 '18 at 17:11
5

Geometry paster

Turns out we had a task for this too, so here we go:

3
  • 1
    Hallo Maxim, great work! Tested today the plugin. Does exactly what I was looking for. I like the integration in the edit-menu. Fits perfect there. Many many thanks.
    – Michael
    Dec 20 '18 at 21:25
  • Hi Maxim, sorry, but I don't understand Russian language. Is there an English translation for the Geometry Paster plugin?
    – Stu Smith
    Dec 14 '20 at 17:30
  • I modified my answer to add EN video link (what was I thinking! :shocked:) Dec 15 '20 at 18:19
3

not so visual, but it works

  1. Select feature, copy it
  2. Paste in a text doc, remove all except WKT geom
  3. Add stuff around your WKT: geom_from_wkt('YOUR WKT GEOM HERE')
  4. Select feature to replace geometry
  5. Use resulting line in Field calculator to replace geometry with a new one (text from 3)
1
  • Hi Maxim, thanks for this suggestion. I‘ll give it a try. Maybe next year with a little more spare time I wanna have a closer look at the plugin development. I‘m shure it should be possible with that.
    – Michael
    Dec 8 '18 at 13:45
2

You can select the source feature and copy ("Edit > Copy Features" or "CTRL + C"), then, in edit mode with the destination feature selected, use the "Delete Part" tool and click on the geometry you want to replace. After that, with the feature still selected (you can have the attribute table open to be sure because your feature will no longer have a geometry), use the "Add Part" tool and paste the copied geometry.

You can use the method to replace some or all parts of multipart geometry or the geometry of single part geometries.

  • Copy source geometry
  • Select destination feature
  • Delete Part
  • Add Part

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.