Bug report #11400
merge features disregards type
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Digitising | ||
Affected QGIS version: | 2.4.0 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 19682 |
Description
When editing a LINESTRING, select connected strings and click the Merge Selected Features and the operation is thrown out since the merge attempts to create a MULTILINESTRING.
It should attempt to create a new feature of the same type (or merge into one of the existing features). If some lines are not actually touching then there should be a different error such as 'snap lines before attempting to merge SINGLEPART features'
Related issues
History
#1 Updated by Giovanni Manghi about 10 years ago
- Status changed from Open to Feedback
- Category changed from Edit widget to Digitising
what data type? shapes? postgis?
it seems fine to me on 2.4 but on master I'm getting #11405 using postgis data.
#2 Updated by Gavin Fleming about 10 years ago
- Status changed from Feedback to Closed
postgis
I've done some more testing in 2.4 and it is working in so perhaps the lines that caused the original error were not sharing endpoints.
#3 Updated by Giovanni Manghi about 10 years ago
- Resolution set to invalid
#4 Updated by Gavin Fleming about 10 years ago
- Status changed from Closed to Reopened
I cannot get LineStrings to merge in a layer with LineString geometry after digitising and snapping. The merge tool complains it would result in an incompatible geometry type. It is apparently trying to construct a MultiLinestring because the shared endpoints are not exactly the same. If it only does this if the line endpoints are not exactly the same then it suggests that snapping is at fault?
I can get LineStrings to merge only if I split a line and then merge the resulting parts, demonstrating that while splitting leaves the resulting endpoints exactly the same, snapping does not. (This unfortunately has another effect #11629)
#5 Updated by Giovanni Manghi about 10 years ago
- Resolution deleted (
invalid) - Status changed from Reopened to Feedback
Gavin Fleming wrote:
I cannot get LineStrings to merge in a layer with LineString geometry after digitising and snapping. The merge tool complains it would result in an incompatible geometry type. It is apparently trying to construct a MultiLinestring because the shared endpoints are not exactly the same. If it only does this if the line endpoints are not exactly the same then it suggests that snapping is at fault?
I cannot confirm, at least in part, on QGIS 2.6 and master:
- I imported a shapefiles into postgis with attention to have a LINESTRING table, activated snapping, created a new line and snapped the last node to the last node of an existing line, saved, and merged the two lines with no issue.
- on the other hand if the last node of the new line is snapped not on the last node of an existing line then merging fails, and my gut feeling is that is right (I may be wrong), because you cannot draw/digitize a line and a dangle as one thing.
#6 Updated by Gavin Fleming about 10 years ago
I digitised two lines, ensuring that they snapped and that the second line started at the end of the first line. See how the snap has not resulted in equal coordinates. Granted, in the last three decimal places but it is enough to cause the merge to fail.
LINESTRING(17.08060206897540567 -22.55767896518500493, 17.08092911456730434 -22.55765710289882264, 17.08145870318813664 -22.55776894197441962, 17.08184032685599263 -22.55786277298669518) LINESTRING(17.08184032685599263 -22.55786277298669162, 17.08209343151344584 -22.55790242368775367, 17.08263860269920897 -22.5580250999264571, 17.08278665510170313 -22.55818775896348782, 17.08275566838831594 -22.55845900022283956)
#7 Updated by Giovanni Manghi about 10 years ago
Gavin Fleming wrote:
I digitised two lines, ensuring that they snapped and that the second line started at the end of the first line. See how the snap has not resulted in equal coordinates. Granted, in the last three decimal places but it is enough to cause the merge to fail.
[...]
ok, but anyway I also tested (with PostGIS) and here (on both Linux and Windows, using postgis layers on local servers) works as expected.
#8 Updated by Giovanni Manghi about 10 years ago
Gavin Fleming wrote:
I digitised two lines, ensuring that they snapped and that the second line started at the end of the first line. See how the snap has not resulted in equal coordinates. Granted, in the last three decimal places but it is enough to cause the merge to fail.
[...]
I cannot confirm also after checking as you the geometries, snapped nodes coordinate are identical.
LINESTRING
LINESTRING
#9 Updated by Giovanni Manghi over 9 years ago
- Status changed from Feedback to Closed
- Resolution set to not reproducable
closing for lack of feedback.
#10 Updated by michele zanolli over 9 years ago
- Status changed from Closed to Reopened
In version 2.10.1 (and trunk) I cannot merge two LINESTRING in one LINESTRING. QGIS attempts to create a MULTILINESTRING
Same result with shapefile or postgis layer. Follow these instructions to reproduce:
- split a single line on an existing vertex in two lines
- select those two lines and try to merge them again in a single line
- the result is a MULTILINESTRING in shapefile, or an error if the layer is a postgis LINESTRING
Can anyone confirm?
Thanks
As a temporary workaround, I am using succesfully the "Join multiple lines" plugin
#11 Updated by michele zanolli over 9 years ago
I forgot... tested with Ubuntu 14.04 and Debian 8, compiled with GDAL 2.0.0
#12 Updated by Jürgen Fischer about 9 years ago
- Status changed from Reopened to Feedback
#13 Updated by michele zanolli about 9 years ago
If features are Postgis layers, with primary key integer serial, the union does not work. Also splitting features throws an error when saving.
PostGIS error while adding features: ERROR: null value in column "ogc_fid" violates not-null constraint
#14 Updated by michele zanolli about 9 years ago
I'm sorry, it was my error. Now it works well!
Thanks
#15 Updated by Paolo Cavallini about 9 years ago
So, can this be closed?
#16 Updated by Jürgen Fischer about 9 years ago
- Status changed from Feedback to Closed
- Resolution changed from not reproducable to fixed/implemented