Bug report #21213

Pasting linestring into polygon layer does not produce polygon

Added by Cory Albrecht about 5 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:Nyall Dawson
Category:Digitising
Affected QGIS version:3.4.4 Regression?:No
Operating System:Ubuntu 18.10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29031

Description

In 2.18.x and prior, if you copied a line that was a circle and then pasted it into a polygon layer, you would get a new polygon.

In 3.4 when you try that, it appears to add it to the polygon layer as still a linestring. In the attached image the pasted feature is the group of vertex crosses with no lines between them or filled colour.

If you try to save that to PostGIS the error message returned is: ERROR: 1 feature(s) not added - geometry type is not compatible with the current layer.

Screenshot from 2019-02-08 22-16-04.png (689 KB) Cory Albrecht, 2019-02-09 04:16 AM

Associated revisions

Revision 71bdc319
Added by Nyall Dawson about 5 years ago

Fix pasting linestring into polygon layer should auto convert to polygon

(And polygon->lines, lines->points, polygon->points, etc)

Fixes #21213

Revision 43405182
Added by Nyall Dawson about 5 years ago

Fix pasting linestring into polygon layer should auto convert to polygon

(And polygon->lines, lines->points, polygon->points, etc)

Fixes #21213

(cherry picked from commit 71bdc3192df71aa6a5ca437ff435bd94557a85d6)

History

#1 Updated by Giovanni Manghi about 5 years ago

  • Status changed from Open to Feedback
  • Priority changed from High to Normal
  • Category changed from Editing to Digitising

I'm not sure that in 2.* the behavior you describe was implemented by design, actually I'm a bit surprised it worked and not surprised it does not work on QGIS 3. This should be asked/clarified in the developers mailing list.

#2 Updated by Cory Albrecht about 5 years ago

Giovanni Manghi wrote:

I'm not sure that in 2.* the behavior you describe was implemented by design, actually I'm a bit surprised it worked and not surprised it does not work on QGIS 3. This should be asked/clarified in the developers mailing list.

The 2.18 docs recommend it so it appears to be there by design. https://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/editing_geometry_attributes.html#cutting-copying-and-pasting-features

-=-=
Transform polygon into line and vice-versa using copy/paste

Copy a line feature and paste it in a polygon layer: QGIS pastes in the target layer a polygon whose boundary corresponds to the closed geometry of the line feature. This is a quick way to generate different geometries of the same data.
-=-=

#3 Updated by Giovanni Manghi about 5 years ago

Cory Albrecht wrote:

Giovanni Manghi wrote:

I'm not sure that in 2.* the behavior you describe was implemented by design, actually I'm a bit surprised it worked and not surprised it does not work on QGIS 3. This should be asked/clarified in the developers mailing list.

The 2.18 docs recommend it. https://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/editing_geometry_attributes.html#cutting-copying-and-pasting-features

ok cool, is not the first or the last qgis feature I didn't knew it existed. But anyway we should ask if this was removed by design in QGIS3 (as the digitizing code changes quite a lot).

#4 Updated by Cory Albrecht about 5 years ago

Giovanni Manghi wrote:

ok cool, is not the first or the last qgis feature I didn't knew it existed. But anyway we should ask if this was removed by design in QGIS3 (as the digitizing code changes quite a lot).

I hope it wasn't removed by design as I rely on it. I frequently have need to copy dozens of islands from coastline data which is linestrings to be able to paste into the polygon layer and merge with the mainland feature that I drew.

#5 Updated by Nyall Dawson about 5 years ago

  • Status changed from Feedback to In Progress
  • Assignee set to Nyall Dawson

#6 Updated by Nyall Dawson about 5 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

#7 Updated by Cory Albrecht about 5 years ago

Appears fixed in 3.7 but not in 3.6.0 or 3.4.5

#8 Updated by Nyall Dawson about 5 years ago

Cory - I've just backported to 3.4. But the fix is in 3.6.0 final.

#9 Updated by Cory Albrecht about 5 years ago

Nyall Dawson wrote:

Cory - I've just backported to 3.4. But the fix is in 3.6.0 final.

Works in 3.6.0, haven't tried 3.4.5 or 3.7 yet.

Also available in: Atom PDF