Bug report #20559
Copy>paste from a grass polygon layer gives unexpected results
|Affected QGIS version:||3.5(master)||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||28379|
- Start QGIS with the grass provider enabled.
- Find a grass location in the browser and load a polygon layer.
- Select a feature in the polygon layer.
- Use "Edit-Paste features as", and it will create a polyline layer containing the perimeter of the original polygon, or, if the original polygon shared edges with other polygons, it will create a polyline layer containing a section of the perimeter of the original polygon which wasn't shared with any other polygons.
- Attempt instead to paste it into an existing polygon layer using Edit-Paste and you will get an error because it is trying to paste polyline geometry.
- Use instead "Layer-Save as", and it will correctly create a polygon layer.
Tested with 2.18.23 and 3.4.1 on Windows.
This would be fairly irritating if it took you quite a while to select the right features in the grass layer, and you did "Paste features as", but didn't immediately look at the resulting layer and notice that it was wrong.
Obviously Grass has different ideas about geometry so that it can handle topology, but QGIS can still correctly deal with Grass polygon layers as polygon layers when displaying and querying them, and when converting them with "Layer-Save as". So shouldn't it also be able to cope with copy-paste? If not, would it make sense to disable copy-paste from these layers? I note that you can't use grass layers in processing algorithms - perhaps that is because of the same problem?
#1 Updated by Loïc BARTOLETTI about 1 year ago
Confirmed on 3.4.4 and master with GRASS 7.4 and 7.6
I tested with QGIS Master and GRASS 7.4.4 using memory layers, shapefiles and postgis. Here is my procedure and results:
- Load a GRASS layer with isolated polygons
- Copy a polygon (its wkt is of the Linestring type)
- Paste the polygon into a polygon memory layer: error
- Paste the polygon into a shapefile polygon: success
- Paste the polygon in a postgis polygon layer: error
- Paste the polygon into a line memory layer: success
- Paste the polygon in a shapefile line: success
- Paste the polygon in a postgis line layer: success
I get the same results if I copy a line layer from a shp for example.
The problem is therefore that qgis, recovers a GRASS polygon by its exterior line (you can do the test by importing a polygon with a hole) even if when loading the layer he recognizes it well as a polygon.
Another interesting point is that when you enable the GRASS option to display virtual topologies, if you select the polygon boundaries (LineString layer) the resulting WKT is "NULL".
I think the problem is bigger than just the copy/paste of geometry.